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

Illegal reflective access by org.jenkinsci.utils.process.ProcessUtils to field java.lang.ProcessImpl#pid

    XMLWordPrintable

Details

    Description

      The ProcessUtils in lib-process-utils allows getting PID from a process using reflection. As part of the general Java 9/10/11 hackathon all setAccessible reflection use was being reviewed.

       

      This issue is to remove the reflection use, and as a nice side effect the code will work on Windows too. However, this requires upgrading to Java 9+, so I don't really expect it to happen anytime soon. For now I wanted to preserve the little bit of work I did.

      Attachments

        Activity

          markewaite Mark Waite added a comment -

          As far as I can tell, the process-utils package that is provided by the lib-process-utils GitHub repository is only used in the acceptance test harness and in the docker-fixtures library. Once we've switched to require Java 11, the library can use the Java 11 ProcessHandle class to return the process ID of the current process.

          There is no reference to the process-utils package in Jenkins core or in any of the 1500+ plugins that I searched.

          markewaite Mark Waite added a comment - As far as I can tell, the process-utils package that is provided by the lib-process-utils GitHub repository is only used in the acceptance test harness and in the docker-fixtures library . Once we've switched to require Java 11, the library can use the Java 11 ProcessHandle class to return the process ID of the current process. There is no reference to the process-utils package in Jenkins core or in any of the 1500+ plugins that I searched.
          oleg_nenashev Oleg Nenashev added a comment -

          Maven Compile r3.8.0 supports Multi-release JARs, so maybe we need another PR

          oleg_nenashev Oleg Nenashev added a comment - Maven Compile r3.8.0 supports Multi-release JARs, so maybe we need another PR
          jonahgraham Jonah Graham added a comment -

          It works in Java9+ so far, just gives the standard warning:

          WARNING: Illegal reflective access by org.jenkinsci.utils.process.ProcessUtils (file:/scratch/jenkins/git/lib-process-utils/target/classes/) to field java.lang.ProcessImpl.pid

           

           

          jonahgraham Jonah Graham added a comment - It works in Java9+ so far, just gives the standard warning: WARNING: Illegal reflective access by org.jenkinsci.utils.process.ProcessUtils ( file:/scratch/jenkins/git/lib-process-utils/target/classes/ ) to field java.lang.ProcessImpl.pid    
          oleg_nenashev Oleg Nenashev added a comment -

          It seems the current code is not going to work on Java 9+, right?

          oleg_nenashev Oleg Nenashev added a comment - It seems the current code is not going to work on Java 9+, right?

          People

            Unassigned Unassigned
            jonahgraham Jonah Graham
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: