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

Andrew Dinn adinn at redhat.com
Fri May 19 11:28:51 UTC 2017


On 19/05/17 11:24, Alan Bateman wrote:
> On 19/05/2017 10:20, Rafael Winterhalter wrote:
> 
>> :
>>
>> It is the exact purpose of a Java agent to allow the enhancement of a
>> Java application that is independent of a particular Java process.
>> Therefore, it should not be a decission bound to the creation or
>> bundeling of the Java application if such user-site monitoring is
>> required. Instead, it should always be possible to attach a Java agent
>> for a standalone Java process. Also, I cannot find any comment about
>> the Java agent functionality to be optional despite the mentioned
>> change set:
>> https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/package-summary.html
>> - Neither would anybody using the functionality expect it to be
>> optional. I work with agents everyday and this is the first time I
>> hear it.
>>
> I don't have time to debate this topic just now but just on optionally,
> the tool interfaces have always been optional. It might need digging to
> find all the history but as I recall, in 2004 the then in-progress
> JSR-163 spec was clarified to make the optionality clear. This is why
> the JVM TI spec has the statement "JVM TI may not be available in all
> implementations of the JavaTM virtual machine". The wording in the
> java.lang.instrument package description wasn't as clear, something that
> came to light when shaking out the details of Compact Profiles for Java
> SE 8. This lead to a small clarification [1] that I mentioned.

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.

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

  ii) image builders are aware when they are making such a choice

  ii) image users are aware that a specific image contains agent support

The latter point (or two points) are, perhaps, impacted by the provision
made for packaging of various standard images such as minimal, compact,
full etc. I am afraid that I am not clear to what degree these
'standard' configurations are actually defined by the current tools or
are simply places on the image configuration map that users of jlink
must visit under their own steam (I remember reading about them in the
JSR docs but I am not very familiar with the current operation or
implementation of the jlink tool)

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?

regards,


Andrew Dinn
-----------
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander


More information about the jigsaw-dev mailing list