-
Enhancement
-
Resolution: Unresolved
-
P4
-
24
-
generic
-
linux, os_x
to reproduce:
jcmd <pid> VM.set_flag HeapDumpPath <long_string>
or
HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(String.valueOf(pid));
vm.setFlag("HeapDumpPath", "<long_string>");
when <long_string> contains more than 1024 chars
causes:
java.io.IOException: Premature EOF
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.readInt(HotSpotVirtualMachine.java:355)
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.processCompletionStatus(HotSpotVirtualMachine.java:392)
at jdk.attach/sun.tools.attach.VirtualMachineImpl.execute(VirtualMachineImpl.java:183)
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.executeCommand(HotSpotVirtualMachine.java:324)
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.setFlag(HotSpotVirtualMachine.java:297)
But AttachOperationFailedException should be thrown in the case
Per AttachOperationFailedException spec:
Exception type to signal that an attach operation failed in the target VM.
This exception can be thrown by the various operations of VirtualMachine when the operation fails in the target VM. If there is a communication error, a regular IOException will be thrown.
jcmd <pid> VM.set_flag HeapDumpPath <long_string>
or
HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(String.valueOf(pid));
vm.setFlag("HeapDumpPath", "<long_string>");
when <long_string> contains more than 1024 chars
causes:
java.io.IOException: Premature EOF
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.readInt(HotSpotVirtualMachine.java:355)
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.processCompletionStatus(HotSpotVirtualMachine.java:392)
at jdk.attach/sun.tools.attach.VirtualMachineImpl.execute(VirtualMachineImpl.java:183)
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.executeCommand(HotSpotVirtualMachine.java:324)
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.setFlag(HotSpotVirtualMachine.java:297)
But AttachOperationFailedException should be thrown in the case
Per AttachOperationFailedException spec:
Exception type to signal that an attach operation failed in the target VM.
This exception can be thrown by the various operations of VirtualMachine when the operation fails in the target VM. If there is a communication error, a regular IOException will be thrown.
- relates to
-
JDK-8334169 Long arguments of attach operation are silently truncated on Windows
- Resolved