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

Improve Java 9 support #52

Open
henri-tremblay opened this issue Oct 12, 2017 · 2 comments
Open

Improve Java 9 support #52

henri-tremblay opened this issue Oct 12, 2017 · 2 comments

Comments

@henri-tremblay
Copy link
Contributor

henri-tremblay commented Oct 12, 2017

After playing a bit with Java 9, here is what I've found:

  • Java 9 can't load the agent. So UnsafeSizeOf is used
  • Then it works well excecpt: We get Illegal access warnings from ObjectGraphWalker

Also, Java 9 is using less memory (good!) so we need to adapt our tests accordingly.

@henri-tremblay
Copy link
Contributor Author

Some really interesting answers from the jdk9 mailing list:

  • Self-attach is not allowed anymore
  • To circumvent it, you can for instance look at what Byte Buddy does, or simply depend on byte-buddy-agent to get an instance of Instrumentation by doing inst = ByteBuddyAgent.install();
    For the code, see https://github.com/raphw/byte-buddy/tree/master/byte-buddy-agent
  • Add -Djdk.attach.allowAttachSelf=true
  • Another way is to use ProcessBuilder to create another process and have the new process attach. This follows all of the current rules. Several projects are using this approach.

@henri-tremblay
Copy link
Contributor Author

If the agent get loaded correctly, it can also be used to open modules (including the JDK) which should allow ObjectGraphWalker to work.

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 a pull request may close this issue.

1 participant