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

Jenkins Executor, newBuild and SCM logic should be robust runtime exceptions in bogus plugins

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      We have identified an issue with dead Jenkins executor, which happens with the following stacktrace:

      java.lang.NullPointerException 
      at org.jenkinsci.plugins.p4.client.ConnectionConfig.<init>(ConnectionConfig.java:18) 
      at org.jenkinsci.plugins.p4.client.ConnectionHelper.<init>(ConnectionHelper.java:61) 
      at org.jenkinsci.plugins.p4.PerforceScm.guessBrowser(PerforceScm.java:186) 
      at hudson.scm.SCM.getEffectiveBrowser(SCM.java:146) 
      at hudson.scm.ChangeLogSet.browserFromBuild(ChangeLogSet.java:82) 
      at hudson.scm.ChangeLogSet.<init>(ChangeLogSet.java:76) 
      at com.tikal.jenkins.plugins.multijob.MultiJobChangeLogSet.<init>(MultiJobChangeLogSet.java:11) 
      at com.tikal.jenkins.plugins.multijob.MultiJobBuild.<init>(MultiJobBuild.java:36) 
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
      at java.lang.reflect.Constructor.newInstance(Constructor.java:408) 
      at jenkins.model.lazy.LazyBuildMixIn.newBuild(LazyBuildMixIn.java:184) 
      at hudson.model.AbstractProject.newBuild(AbstractProject.java:1018) 
      at hudson.model.AbstractProject.createExecutable(AbstractProject.java:1209) 
      at hudson.model.AbstractProject.createExecutable(AbstractProject.java:144) 
      at hudson.model.Executor$1.call(Executor.java:364) 
      at hudson.model.Executor$1.call(Executor.java:346) 
      at hudson.model.Queue._withLock(Queue.java:1379) 
      at hudson.model.Queue.withLock(Queue.java:1240) 
      at hudson.model.Executor.run(Executor.java:346)
      

      And... all Jenkins logic layers do not catch Runtime exceptions and hence lead to the executor death. These exceptions should be handled in...

      1) hudson.model.Executor.run
      2) jenkins.model.lazy.LazyBuildMixIn.newBuild
      3) hudson.scm.ChangeLogSet.browserFromBuild

      It would make the core more robust

        Attachments

          Issue Links

            Activity

            Hide
            rysteboe Rebecca Ysteboe added a comment - - edited

            Oleg Nenashev, initial thoughts on this:

            Executor should be handled through an UncaughtExceptionHandler rather than adding a catch block for RuntimeExceptions (there's already a catch Error | Exception block inside of run() that does some logging before dying).  The handler can then try to restart the thread (on a delay?).

            LazyBuildMixIn/ChangeLogSet - just log so that the executor doesn't die?  Is there value in retrying the operations here? 

            Show
            rysteboe Rebecca Ysteboe added a comment - - edited Oleg Nenashev , initial thoughts on this: Executor should be handled through an UncaughtExceptionHandler rather than adding a catch block for RuntimeExceptions (there's already a catch Error | Exception block inside of run() that does some logging before dying).  The handler can then try to restart the thread (on a delay?). LazyBuildMixIn/ChangeLogSet - just log so that the executor doesn't die?  Is there value in retrying the operations here? 
            Hide
            rysteboe Rebecca Ysteboe added a comment -
            Show
            rysteboe Rebecca Ysteboe added a comment - Ping Oleg Nenashev
            Hide
            jglick Jesse Glick added a comment -

            From a quick glance, I think the only place an exception should be caught is in SCM.getEffectiveBrowser, since this has a sensible default: null. If an NPE were thrown from somewhere else, it would be appropriate IMO to throw it all the way up—just a failed build, no big deal, already logged here.

            Show
            jglick Jesse Glick added a comment - From a quick glance, I think the only place an exception should be caught is in SCM.getEffectiveBrowser , since this has a sensible default: null. If an NPE were thrown from somewhere else, it would be appropriate IMO to throw it all the way up—just a failed build, no big deal, already logged here .
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            core/src/main/java/hudson/scm/SCM.java
            http://jenkins-ci.org/commit/jenkins/6a3e60ef71900704e552a295a802c2caf29a871c
            Log:
            JENKINS-46041 If guessBrowser fails, return null and move on.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/hudson/scm/SCM.java http://jenkins-ci.org/commit/jenkins/6a3e60ef71900704e552a295a802c2caf29a871c Log: JENKINS-46041 If guessBrowser fails, return null and move on.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Oleg Nenashev
            Path:
            core/src/main/java/hudson/scm/SCM.java
            http://jenkins-ci.org/commit/jenkins/bab0dbf91432a057b7b0cda894ce202b32d58322
            Log:
            Merge pull request #3267 from jglick/getEffectiveBrowser-JENKINS-46041

            JENKINS-46041 If guessBrowser fails, return null and move on

            Compare: https://github.com/jenkinsci/jenkins/compare/0d1f80ba9f58...bab0dbf91432

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/scm/SCM.java http://jenkins-ci.org/commit/jenkins/bab0dbf91432a057b7b0cda894ce202b32d58322 Log: Merge pull request #3267 from jglick/getEffectiveBrowser- JENKINS-46041 JENKINS-46041 If guessBrowser fails, return null and move on Compare: https://github.com/jenkinsci/jenkins/compare/0d1f80ba9f58...bab0dbf91432

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                oleg_nenashev Oleg Nenashev
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: