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

Java 17: Stopping a build on a Windows agent fails "Unable to make field private final long java.lang.ProcessImpl.handle accessible"

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • None
    • Jenkins 2.361.1 host running on Ubuntu 20.04 using OpenJDK 17.0.4+8-Ubuntu-120.04, Jenkins Windows Agent running OpenJDK Temurin-17.0.4.1+1
    • 2.371

      I had a build that was stuck on a Windows Agent due to a network issue. I then tried stopping the build using the Jenkins web interface and the build crashed with this stack trace:

      13:07:27  ERROR: Failed to join a process
      13:07:27  java.lang.reflect.InaccessibleObjectException: Unable to make field private final long java.lang.ProcessImpl.handle accessible: module java.base does not "opens java.lang" to unnamed module @5908db45
      13:07:27  	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
      13:07:27  	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
      13:07:27  	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Unknown Source)
      13:07:27  	at java.base/java.lang.reflect.Field.setAccessible(Unknown Source)
      13:07:27  	at org.jvnet.winp.WinProcess.<init>(WinProcess.java:44)
      13:07:27  	at hudson.util.ProcessTree$Windows.get(ProcessTree.java:696)
      13:07:27  	at hudson.util.ProcessTree.killAll(ProcessTree.java:182)
      13:07:27  	at hudson.Proc$LocalProc.destroy(Proc.java:390)
      13:07:27  	at hudson.Proc$LocalProc.kill(Proc.java:382)
      13:07:27  	at hudson.Proc$1.run(Proc.java:167)
      13:07:27  	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      13:07:27  	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
      13:07:27  	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      13:07:27  	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      13:07:27  	at java.base/java.lang.Thread.run(Unknown Source)

      I've seen similar issues before and I'm pretty sure that it's related to JRE 17. Hopefully the stack trace will be helpful.

          [JENKINS-69647] Java 17: Stopping a build on a Windows agent fails "Unable to make field private final long java.lang.ProcessImpl.handle accessible"

          Jannis Achstetter added a comment - - edited

          Affected repo seems to be https://github.com/jenkinsci/winp. Issues and PRs there don't mention Java 17 yet. "winp" component doesn't seem to exist in this bug tracker.

          Jannis Achstetter added a comment - - edited Affected repo seems to be https://github.com/jenkinsci/winp . Issues and PRs there don't mention Java 17 yet. "winp" component doesn't seem to exist in this bug tracker.

          Jannis Achstetter added a comment - Proposed EPIC: https://issues.jenkins.io/browse/JENKINS-67908

          Basil Crow added a comment -

          jachstetsea The fix has been released in 2.371. Can you please verify? Thanks!

          Basil Crow added a comment - jachstetsea The fix has been released in 2.371. Can you please verify? Thanks!

          Hi  basil and thanks for the quick fix. I will test 2.371 later this week, need to switch from LTS to non-LTS for that.

          Is it enough to update the main node and restart the agents or do I need to replace the agent.jar file on all nodes prior to testing?

          Jannis Achstetter added a comment - Hi   basil and thanks for the quick fix. I will test 2.371 later this week, need to switch from LTS to non-LTS for that. Is it enough to update the main node and restart the agents or do I need to replace the agent.jar file on all nodes prior to testing?

          Basil Crow added a comment -

          The fix is on the controller side, so there is no need to update Remoting on the agents to test the fix.

          Basil Crow added a comment - The fix is on the controller side, so there is no need to update Remoting on the agents to test the fix.

          Re-tested and verified. No exception occured. Thanks again for the quick fix! Leaving this issue's status as is since Closed - Fixed is perfectly fine.

          Jannis Achstetter added a comment - Re-tested and verified. No exception occured. Thanks again for the quick fix! Leaving this issue's status as is since Closed - Fixed is perfectly fine.

            basil Basil Crow
            jachstetsea Jannis Achstetter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: