Attaching to a JVM image that does not include java.instrument

Alan Bateman Alan.Bateman at
Fri May 19 13:03:59 UTC 2017

On 19/05/2017 12:28, Andrew Dinn wrote:

> :
> I don't think history is the most important guide here (whatever the
> history might be). If agent support was not optional in the past that is
> no reason to not make it optional now.
My reason for bringing up the history is to make it clear that the 
standard tooling APIs have always been optional ("always" = JSR-163 / 
Java SE 5). A clarification was needed in Java SE 8 to fix an oversight. 
We haven't changed anything for Java SE 9.

> To me it is not a problem that agent operation may be optional. What
> matters is
>    i) it is still possible to choose to include agent support in an image
There are a number of pieces to this.

The biggest part is the JVM TI support that is compiled into libjvm. The 
Oracle JDK downloads include the server VM and the minimal VM. The 
former has the serviceability support compiled in, the minimal VM does 
not. When using `jlink` then you would need to go out of your way to 
specify `--vm=minimal` to exclude the server VM.

For java agent support then you need a java.base/libjvm that includes 
JVM TI and you additionally need to ask `jlink` to include the 
`java.instrument` module. There are several improvements that could be 
done here to ensure that you don't accidentally create a run-time image 
with java.instrument but no libjvm with JVM TI support, ditto for the 
management modules that need instrumentation in the VM.

Another part is the java agent itself. It would be be nice to be able to 
deploy a java agent as a module so that it can be specified to `jlink`. 
We had to punt on this for Java SE 9 / JDK 9 but it's definitely 
something to come back to in the future (only so much that we could take 
on here in one release).
> :
> Does the tooling define specific image configuratons? Is there an
> opportunity/need here to define and make visible a standard image format
> ('instrumentable') which comprises minimal + java.instrument?
Do you mean an aggregator module? Possible although I think `jlink` 
usages are better suited to recipes, esp. when getting into some of the 


More information about the jigsaw-dev mailing list