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

ProcessKillingVeto.all() forces Jenkins class to be instantiated on remote agents

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core

      We have a plugin that is instantiating LocalProc from the agent JVM and is hitting a

      Caused by: java.lang.NoClassDefFoundError: Could not initialize class jenkins.model.Jenkins
          at hudson.util.ProcessKillingVeto.all(ProcessKillingVeto.java:77)
          at hudson.util.ProcessTree$OSProcess.getVeto(ProcessTree.java:237)
          at hudson.util.ProcessTree$UnixProcess.kill(ProcessTree.java:566)
          at hudson.util.ProcessTree$UnixProcess.killRecursively(ProcessTree.java:592)
          at hudson.util.ProcessTree.killAll(ProcessTree.java:141)
          at hudson.Proc$LocalProc.destroy(Proc.java:379)
          at hudson.Proc$LocalProc.kill(Proc.java:371)
          ...
      

      error. The root cause of this issue is that the ProcessKillingVeto.all method forces the Jenkins class to be loaded... this is a bad thing as agents are not supposed to try and instantiate the Jenkins class (that some plugins can sometimes managed to succeed in instantiating the Jenkins class on a remote agent is neither here nor there... we should not be trying to instantiate it at all)

          [JENKINS-38534] ProcessKillingVeto.all() forces Jenkins class to be instantiated on remote agents

          Stephen Connolly added a comment - - edited

          From my analysis of OSS plugins, none of them instantiate a LocalProc from the agent JVM directly and subsequently invoke the kill method.

          Most of the uses I can find rely on join which may explain how the regression introduced in 1.619 was missed until now

          Stephen Connolly added a comment - - edited From my analysis of OSS plugins, none of them instantiate a LocalProc from the agent JVM directly and subsequently invoke the kill method. Most of the uses I can find rely on join which may explain how the regression introduced in 1.619 was missed until now

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          core/src/main/java/hudson/util/ProcessKillingVeto.java
          http://jenkins-ci.org/commit/jenkins/0859573721a5f1c0c225d46c898e23e683ec3550
          Log:
          [FIXED JENKINS-38534] Isolate the code that requires the `Jenkins` class to be loaded from an agent code path

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: core/src/main/java/hudson/util/ProcessKillingVeto.java http://jenkins-ci.org/commit/jenkins/0859573721a5f1c0c225d46c898e23e683ec3550 Log: [FIXED JENKINS-38534] Isolate the code that requires the `Jenkins` class to be loaded from an agent code path

          Code changed in jenkins
          User: Daniel Beck
          Path:
          core/src/main/java/hudson/util/ProcessKillingVeto.java
          http://jenkins-ci.org/commit/jenkins/31ab674c814bf8b987532fcd98b908a59047936f
          Log:
          Merge pull request #2569 from stephenc/jenkins-38534

          [FIXED JENKINS-38534] Isolate the code that requires the `Jenkins` class to be loaded from an agent code path

          Compare: https://github.com/jenkinsci/jenkins/compare/96ec7a267e0e...31ab674c814b

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/java/hudson/util/ProcessKillingVeto.java http://jenkins-ci.org/commit/jenkins/31ab674c814bf8b987532fcd98b908a59047936f Log: Merge pull request #2569 from stephenc/jenkins-38534 [FIXED JENKINS-38534] Isolate the code that requires the `Jenkins` class to be loaded from an agent code path Compare: https://github.com/jenkinsci/jenkins/compare/96ec7a267e0e...31ab674c814b

          Oleg Nenashev added a comment -

          I'd rather consider it as a bug

          Oleg Nenashev added a comment - I'd rather consider it as a bug

            stephenconnolly Stephen Connolly
            stephenconnolly Stephen Connolly
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: