JDK-8043138 : Attach API should not require jvmstat rmi protocol
  • Type: Enhancement
  • Component: core-svc
  • Sub-Component: tools
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-05-14
  • Updated: 2016-03-19
  • Resolved: 2015-11-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b96Fixed
Related Reports
Blocks :  
Relates :  
Description
The implementation of the Attach API uses jvmstat to enumerate the VM on the local system. It would be highly desirable to remove this dependency so that jvmstat is not required. This could be very helpful in small footprint environments to avoid linking in jvmstat when it is not required.
Comments
Even with a lightweight protocol we really should separate the jvmstat APIs and implementations. Eg. for the Attach API it will make no sense to have transitive dependency on the lightweight protocol based remote jvmstat implementation since the Attach API works only locally.
08-10-2015

I agree, that is the direction I am moving in.
26-05-2014

An alternative to removing the dependency would be to re-examine jvmstat so that the remote/RMI support can be separated into its own module.
25-05-2014

I thought this was trivial, but no. I think it is quite easy to walk the files in /tmp/hsperf_data_$user to find pids of running virtual machines. But there are two more things that Attach uses jvmstat for: 1) Determine if a VM is 'attachable'. This is done by looking at the sun.rt.jvmCapabilities object in jvmstat. 2) Get a 'display name' for the VM. Currently this is set to the value of the sun.rt.javaCommand object in jvmstat. We could skip the attachable test and assume that all VMs are attachable, since they have been so since 1.6. If there is an older VM running we would show it as attachable, but then fail if someone actually tries to attach to it. The display name is harder. We could attach to the VM and ask it for a name - that would be slow (and a bit unreliable to always attach to all VMs). We could skip it - but that would make output from listing all VMs very unusable. We could do some OS-specific calls to as the OS for a display name (output of /proc/$pid/cmdline typically).
15-05-2014