Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jdanbrown
Copy link
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