Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-52178

Investigate impact of self-attach flag requirement (Java 9+) on Jenkins plugins

    Details

    • Similar Issues:

      Description

      According to the information from evernat in JENKINS-52092, Monitoring Plugin 1.73.0 requires "-Djdk.attach.allowAttachSelf=true" to be set on master and agent side in order to have the memory histogram in JDK 9. (Edit: with an enhancement in the monitoring plugin 1.73.1, it does not attach itself to the VM in order to get heap histogram in JDK 9. So this plugin does not require to add "-Djdk.attach.allowAttachSelf=true".)

      We still have some plugins attaching to JDK (e.g. File Leak detector plugin), so maybe we need a generic solution for Jenkins packaging (or some documentation about "-Djdk.attach.allowAttachSelf=true").

        Attachments

          Issue Links

            Activity

            oleg_nenashev Oleg Nenashev created issue -
            oleg_nenashev Oleg Nenashev made changes -
            Field Original Value New Value
            Epic Link JENKINS-40689 [ 177392 ]
            oleg_nenashev Oleg Nenashev made changes -
            Link This issue relates to JENKINS-52092 [ JENKINS-52092 ]
            oleg_nenashev Oleg Nenashev made changes -
            Summary Investigate self-attach impact on Jenkins plugins Investigate impact of self-attach flag requirement (Java 9+) on Jenkins plugins
            evernat evernat made changes -
            Description According to the information from [~evernat] in JENKINS-52092, Monitoring Plugin requires "-Djdk.attach.allowAttachSelf=true" to be set on master and agent side in order to have the memory histogram in JDK 9.

            We have other plugins attaching to JDK (e.g. File Leak detector plugin), so maybe we need a generic solution for Jenkins packaging (or some documentation).

            According to the information from [~evernat] in JENKINS-52092, Monitoring Plugin 1.73.0 requires "-Djdk.attach.allowAttachSelf=true" to be set on master and agent side in order to have the memory histogram in JDK 9. (Edit: with an enhancement in the monitoring plugin 1.73.1, it does not attach itself to the VM in order to get heap histogram in JDK 9. So this plugin does not require to add "-Djdk.attach.allowAttachSelf=true".)

            We still have some plugins attaching to JDK (e.g. File Leak detector plugin), so maybe we need a generic solution for Jenkins packaging (or some documentation about "-Djdk.attach.allowAttachSelf=true").
            Hide
            evernat evernat added a comment -

            By reading code, yes the File leak detector plugin is calling the attach method on a com.sun.tools.attach.VirtualMachine instance which may throw something like
            java.io.IOException: Can not attach to current VM
            at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.(HotSpotVirtualMachine.java:75)
            at jdk.attach/sun.tools.attach.VirtualMachineImpl.(VirtualMachineImpl.java:56)
            at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:73)
            at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:249)

            The workaround for this exception is to add "-Djdk.attach.allowAttachSelf=true" in the java command line.

            Except that the file leak detector plugin does not attach from the same process. It creates another java process and attaches to the Jenkins VM from there.

            So I don't think that the file leak detector plugin will fail on JDK 9. The plugin may not be aware of new methods in JDK 9 to leak files but otherwise, I think it will work.

            Show
            evernat evernat added a comment - By reading code, yes the File leak detector plugin is calling the attach method on a com.sun.tools.attach.VirtualMachine instance which may throw something like java.io.IOException: Can not attach to current VM at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.(HotSpotVirtualMachine.java:75) at jdk.attach/sun.tools.attach.VirtualMachineImpl.(VirtualMachineImpl.java:56) at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:73) at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:249) The workaround for this exception is to add "-Djdk.attach.allowAttachSelf=true" in the java command line. Except that the file leak detector plugin does not attach from the same process. It creates another java process and attaches to the Jenkins VM from there. So I don't think that the file leak detector plugin will fail on JDK 9. The plugin may not be aware of new methods in JDK 9 to leak files but otherwise, I think it will work.
            Hide
            evernat evernat added a comment - - edited

            Searching in jenkinsci, there is only one plugin which contains the words "com.sun.tools.attach.VirtualMachine":

            https://github.com/search?q=org%3Ajenkinsci+com.sun.tools.attach.VirtualMachine&type=Code

            This plugin does not seem to be released and it does not attach to the self process.

            Perhaps there are other plugins calling VirtualMachine by using a dependency like the file leak detector plugin, but then I don't know how to find such plugins.

            Show
            evernat evernat added a comment - - edited Searching in jenkinsci, there is only one plugin which contains the words "com.sun.tools.attach.VirtualMachine": https://github.com/search?q=org%3Ajenkinsci+com.sun.tools.attach.VirtualMachine&type=Code This plugin does not seem to be released and it does not attach to the self process. Perhaps there are other plugins calling VirtualMachine by using a dependency like the file leak detector plugin, but then I don't know how to find such plugins.
            evernat evernat made changes -
            Assignee evernat [ evernat ] Oleg Nenashev [ oleg_nenashev ]
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            Yeah, I do not see this plugin in update centers. Not sure what it the purpose of this Proc plugin, so I would not worry
            Thanks for the analysis evernat!

            Show
            oleg_nenashev Oleg Nenashev added a comment - Yeah, I do not see this plugin in update centers. Not sure what it the purpose of this Proc plugin, so I would not worry Thanks for the analysis evernat !
            oleg_nenashev Oleg Nenashev made changes -
            Labels java10 java10 java11
            oleg_nenashev Oleg Nenashev made changes -
            Assignee Oleg Nenashev [ oleg_nenashev ]
            batmat Baptiste Mathus made changes -
            Labels java10 java11 java10 java11 triaged
            evernat evernat made changes -
            Component/s file-leak-detector-plugin [ 17595 ]
            Component/s monitoring-plugin [ 15958 ]

              People

              • Assignee:
                Unassigned
                Reporter:
                oleg_nenashev Oleg Nenashev
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: