HOTFIX: Fix null pointer when getting metric value in MetricsReporter#11248
Conversation
The alive stream threads metric relies on the threads field as a monitor object for its synchronized block. When the alive stream threads metric is registered it isn't initialised so any call to get the metric value before it is initialised will result in a null pointer exception.
|
Requesting review from @ableegoldman and @wcarlson5 please |
wcarlson5
left a comment
There was a problem hiding this comment.
This seems like a reasonable fix
ableegoldman
left a comment
There was a problem hiding this comment.
LGTM, thanks for the fix!
…#11248) The alive stream threads metric relies on the threads field as a monitor object for its synchronized block. When the alive stream threads metric is registered it isn't initialised so any call to get the metric value before it is initialised will result in a null pointer exception. Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>, Walker Carlson <wcarlson@confluent.io>
|
Merged to trunk and cherrypicked to 2.8 |
|
Approved for 3.0 as well. |
…#11248) The alive stream threads metric relies on the threads field as a monitor object for its synchronized block. When the alive stream threads metric is registered it isn't initialised so any call to get the metric value before it is initialised will result in a null pointer exception. Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>, Walker Carlson <wcarlson@confluent.io>
|
Cherrypicked to 3.0 |
|
Hi. This PR seemed to break the 2.8 branch. When I try to run checkstyle I see: I believe that file was added in this commit. |
|
@jolshan ah, whoops. Thanks for the heads up. I'll get a patch ready |
|
Fix is available here: #11257 This also got me digging into why we had to make Anyways, thanks very much for bringing this up! |
…uster (#11257) A backport of #11248 broke the 2.8 build due to usage of the EmbeddedKafkaCluster#stop method, which used to be private. It seems we made this public when we upgraded to JUnit5 on the 3.0 branch and had to remove the ExternalResource that was previously responsible for calling start() and stop() for this class using the no-longer-available @ClassRule annotation. Rather than adapt this test to the 2.8 style by migrating it to use @ClassRule as well, I opted to just make the stop() method public as well (since its analogue start()` has always been public anyways). This should hopefully prevent any future backports that include integration tests from having to manually go in and adapt the test, or accidentally break the build as happened here. Reviewers: Luke Chen <showuon@gmail.com>
…apache#11248) The alive stream threads metric relies on the threads field as a monitor object for its synchronized block. When the alive stream threads metric is registered it isn't initialised so any call to get the metric value before it is initialised will result in a null pointer exception. Reviewers: Anna Sophie Blee-Goldman <ableegoldman@apache.org>, Walker Carlson <wcarlson@confluent.io>
The alive stream threads metric relies on the threads field as a monitor object for
its synchronized block. When the alive stream threads metric is registered it isn't
initialised so any call to get the metric value before it is initialised will result
in a null pointer exception.
This is tested in a minimal integration test where the KafkaStreams object is created
but not started and the test loops through all metric values to check they're not null.
Committer Checklist (excluded from commit message)