Protocol version of Attach API

Yasumasa Suenaga yasuenag at gmail.com
Tue Feb 26 06:32:35 UTC 2019


Hi David,

2019年2月26日(火) 15:14 David Holmes <david.holmes at oracle.com>:
>
> On 26/02/2019 4:01 pm, Yasumasa Suenaga wrote:
> > Hi all,
> >
> > When I attached to VM which is after 8215622 change via jcmd in JDK 8
> > on Linux, jcmd hanged.
>
> What command are you trying to execute through jcmd?

I tried VM.info, Thread.print, and GC.run .


> Do we support connection to later VMs from earlier JDK tools?

I could not find the spec about this.
So I asked to serviceability folks before filing this to JBS :-)


> > I checked the status of target VM and jcmd,
> > LinuxAttachListener::read_request() on target VM was waiting for
> > subsequent argument.
> >
> > 8215622 increased number of arguments of Attach API [1].
>
> Isn't that supposed to be a maximum number of arguments? So if less are
> sent it should still work okay?

This change affects to request reading on AttachListener.

AttachListener set expected string (includes arguments) count from
maximum number of arguments.
  http://hg.openjdk.java.net/jdk/jdk/file/616a32d6b463/src/hotspot/os/linux/attachListener_linux.cpp#l247

This value uses as loop condition.
  http://hg.openjdk.java.net/jdk/jdk/file/616a32d6b463/src/hotspot/os/linux/attachListener_linux.cpp#l297


> > Of course it is my mistake, but I think we can increase version number
> > (PROTOCOL_VERSION) because Attach API has been updated in 8215622.
> >
> > What do you think?
>
> That will just cause it be rejected rather than hang - right?

No, jcmd is hanged.
You can reproduce it on Linux box.

My environment:
  Target VM: jdk/jdk fastdebug build (changeset: 53918:616a32d6b463)
  jcmd: OpenJDK 8u201 (java-1.8.0-openjdk-1.8.0.201.b09-2.fc29.x86_64)

I checked the value of `str_count` and `left` on
LinuxAttachListener::read_request() in target VM via GDB.
Target VM waited subsequent arguments.


Thanks,

Yasumasa


> Thanks,
> David
> -----
>
> > If it is accepted, I will file it to JBS.
> >
> >
> > Thanks,
> >
> > Yasumasa
> >
> >
> > [1] http://hg.openjdk.java.net/jdk/jdk/rev/e7cf035682e3#l2.1
> >


More information about the serviceability-dev mailing list