Background:
Optional capabilities of java.lang.instrument (JLI) agents are specified as attributes in the JAR manifest. They cannot (currently) be set dynamically by agent code. The current implementation of JLI always uses a single implementation of "Instrumentation" which holds the capabilities.
The bug:
As a result, if multiple JLI agents are loaded (either at the command line or via attach) the first loaded agent creates the "Instrumentation" instance and sets its capabilities. A subsequent agent, with possibly greater capabilities specified in its attributes then has these capabilities ignored. So the bug is first one wins.
Optional capabilities of java.lang.instrument (JLI) agents are specified as attributes in the JAR manifest. They cannot (currently) be set dynamically by agent code. The current implementation of JLI always uses a single implementation of "Instrumentation" which holds the capabilities.
The bug:
As a result, if multiple JLI agents are loaded (either at the command line or via attach) the first loaded agent creates the "Instrumentation" instance and sets its capabilities. A subsequent agent, with possibly greater capabilities specified in its attributes then has these capabilities ignored. So the bug is first one wins.