Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8334168

Attach operation with long arguments should throw AttachOperationFailedException

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • 24
    • 24
    • core-svc
    • 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.

            amenkov Alex Menkov
            amenkov Alex Menkov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: