Skip to content

Fix: NPE in myLoad if cluster isn't yet started#19

Open
jdanbrown wants to merge 3 commits intoboundary:masterfrom
jdanbrown:fix-myLoad-npe
Open

Fix: NPE in myLoad if cluster isn't yet started#19
jdanbrown wants to merge 3 commits intoboundary:masterfrom
jdanbrown:fix-myLoad-npe

Conversation

@jdanbrown
Copy link
Copy Markdown
Contributor

myLoad gets a null cluster.loadMap if we haven't yet connected to the cluster, which throws a NullPointerException when we try to .toString it for the debug logging. I went ahead and made myLoad overly robust to null things, just so that it doesn't have to be concerned with which Cluster fields can be null and which can't.

This is a simple commit in isolation, but I branched it off of the commits in #10 since it now lives in a different file. Let me know if you'd rather I branch it independently.

If we don't, then then MetricsRegistry will continue holding onto old
gauges and meters, and when reporters like GraphiteReporter ask the
MetricsRegistry for all known metrics, it will get a bunch of orphaned
metrics that we never unregistered when the work unit was shutdown.
Querying the orphaned meters will just return and report 0 values, which
is mostly harmless, but querying the orphaned gauges will ask for things
that might no longer exist, which is potentially harmful. Further, the
orphaned gauges could hold references to otherwise orphaned objects and
cause memory leaks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant