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 #154

Closed
Closed

Conversation

roberttoyonaga
Copy link
Contributor

Summary

Fixes a NPE encountered when attempting to connect with a non-hotspot VM.

Problem Description

See error stack trace here.

NPE occurs because FlightRecorderServiceV2.connection is not initialized before use. This can happen in the FlightRecorderServiceV2 constructor when isDynamicFlightRecorderSupported(IConnectionHandle) returns false because it calls ConnectionToolkit.isHotSpot(IConnectionHandle) which returns false for native images. This allows isFlightRecorderDisabled(IConnectionHandle) to be evaluated which results in the stack trace linked above.

Solution

Initialize FlightRecorderServiceV2.connection earlier.

@andrewazores
Copy link
Member

andrewazores commented Aug 24, 2022

That's occurring in the forked JMC code that we're carrying for downstream build purposes, so this means that at some point JMC itself was impacted by the same bug too. Could you verify if the same NPE occurs when you try to connect to your NI JMX server using JMC?

If JMC is affected then the best flow would be to work with them to fix it upstream, and then we pull that commit back down here, possibly as part of #95. If JMC is not affected (ie this bug is already fixed upstream) then we can accept this minor patch for now, but it would be superseded by the upstream fix when #95 is finished.

@roberttoyonaga
Copy link
Contributor Author

That's occurring in the forked JMC code that we're carrying for downstream build purposes, so this means that at some point JMC itself was impacted by the same bug too. Could you verify if the same NPE occurs when you try to connect to your NI JMX server using JMC?

If JMC is affected then the best flow would be to work with them to fix it upstream, and then we pull that commit back down here, possibly as part of #95. If JMC is not affected (ie this bug is already fixed upstream) then we can accept this minor patch for now, but it would be superseded by the upstream fix when #95 is finished.

Ok I see. Yup I'll give it a try with JMC too!

@roberttoyonaga
Copy link
Contributor Author

It seems as though I can connect to the NI mbean server and invoke operations on the FlightRecorderMXBean with JMC 8.01. So maybe the problem has been fixed upstream already.

@andrewazores
Copy link
Member

#155

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.

2 participants