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

Java agents aren't (really) supported #528

Open
pron opened this Issue Oct 23, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@pron

pron commented Oct 23, 2014

The -javaagent flag is passed to the JVM in java.cc, but the classpath is handled by RunJava. This is not how Java agents work!

The spec says this:

The agent class will be loaded by the system class loader (see ClassLoader.getSystemClassLoader).

I.e., the Java agent must see the classpath! It actually means more than that. The agent and the application share a class loader so they have access to the same static fields etc.

This results in a failure whenever a Java agent tries to access a class that is contained on the classpath, but not in the agent JAR.

A related problem is that the spec says:

The agent JAR is appended to the system class path.

But this isn't implemented.

@pron

This comment has been minimized.

Show comment
Hide comment
@pron

pron Oct 23, 2014

Actually, what happens is that the master context is used by the agent, and not the application's context, which is created by RunJava, which is launched after the agent.

This points the way to a possible fix: set up the isolated context in a java agent that is always passed first to the JVM.

pron commented Oct 23, 2014

Actually, what happens is that the master context is used by the agent, and not the application's context, which is created by RunJava, which is launched after the agent.

This points the way to a possible fix: set up the isolated context in a java agent that is always passed first to the JVM.

@circlespainter

This comment has been minimized.

Show comment
Hide comment
@circlespainter

circlespainter commented Aug 7, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment