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

forward port fix for Bug 13645891 to JDK8 jcmd (1024 byte file size limit issue)

XMLWordPrintable

    • b36
    • generic
    • generic

        This is a "forward port" of the fix for Bug 13645891 in JRockit's JRCMD command to Oracle JDK's new jcmd command.

        From 13645891
        ===
        I created a jrcmd script and was using something like the below to run it:

        jrcmd 12345 -f commands.txt

        It turns out that the contents of the commands.txt file must not be more than roughly 256 bytes, otherwise jrcmd will return a cryptic error message (OS dependent, the below is what it looks like on Linux):

        jrcmd 11052 -f commands.txt
        11052:
        java.io.IOException: Premature EOF
                at
        sun.tools.attach.HotSpotVirtualMachine.readInt(HotSpotVirtualMachine.java:226)
                at sun.tools.attach.LinuxVirtualMachine.execute(LinuxVirtualMachine.java:175)
                at
        sun.tools.attach.HotSpotVirtualMachineAccess.execute(HotSpotVirtualMachineAccess.java:17)
                at jrockit.tools.jrcmd.JrCmd.executeCommandForPid(JrCmd.java:115)
                at jrockit.tools.jrcmd.JrCmd.main(JrCmd.java:90)

        The reason for this is that the attach implementation in JRockit limits the attach operation commands to 256 characters (see attach_internal.h/MAX_ARG_LEN) and jrcmd sends the whole file contents as a single command to the VM. The actual check which bails out the execution can be found in attach.c:attachOperationSetArg called from attach_linux.c:read_request on Linux.
        ===

              dbuck David Buck
              dbuck David Buck
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: