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

Executor.getIdleStartMilliseconds throws NPE when executor == null

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

      Executables.getEstimatedDurationFor() throws NPE when the executable is null. This can happen if Computer.getIdleStartMilliseconds() is called before the executable is set to non-null in Computer.run() or if the executor thread exits prematurely

      We are seeing this in the mansion-cloud-plugin and I believe it is becuase the executor thread is dying prematurely. Restarting the thread fixes it.

      This issue causes other issues down the chain and prevents further provisioning and cleanup of mansion-cloud slaves.

      I'm unsure what the fix would be here. Possibly to return Long.MIN_VALUE if the executable is null (Look at Computer.getIdleStartMilliseconds())

      SEVERE: Timer task hudson.slaves.ComputerRetentionWork@110b47e0 failed
      java.lang.NullPointerException
            at hudson.model.queue.Executables.getEstimatedDurationFor(Executables.java:69)
            at hudson.model.Executor.getIdleStartMilliseconds(Executor.java:870)
            at hudson.model.Computer.getIdleStartMilliseconds(Computer.java:957)
            at com.cloudbees.jenkins.plugins.mtslavescloud.MansionComputer.getIdleStartMillisecondsAfterConnect(MansionComputer.java:171)
            at com.cloudbees.jenkins.plugins.mtslavescloud.MansionRetentionStrategy.isIdleForTooLong(MansionRetentionStrategy.java:103)
      
      

          [JENKINS-30456] Executor.getIdleStartMilliseconds throws NPE when executor == null

          Code changed in jenkins
          User: Valentina Armenise
          Path:
          core/src/main/java/hudson/model/queue/Executables.java
          http://jenkins-ci.org/commit/jenkins/67e2637a57be9b6817621dbfcdec2b2dc27afdb9
          Log:
          JENKINS-30456Executable can be null in getEstimatedDurationFor

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Valentina Armenise Path: core/src/main/java/hudson/model/queue/Executables.java http://jenkins-ci.org/commit/jenkins/67e2637a57be9b6817621dbfcdec2b2dc27afdb9 Log: JENKINS-30456 Executable can be null in getEstimatedDurationFor

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          core/src/main/java/hudson/model/queue/Executables.java
          http://jenkins-ci.org/commit/jenkins/9bba7c5fa3234c674eb7866618995fd5a22d79d8
          Log:
          Merge pull request #1873 from varmenise/JENKINS-30456

          JENKINS-30456Executable can be null in getEstimatedDurationFor

          Compare: https://github.com/jenkinsci/jenkins/compare/858849ef42ab...9bba7c5fa323

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/model/queue/Executables.java http://jenkins-ci.org/commit/jenkins/9bba7c5fa3234c674eb7866618995fd5a22d79d8 Log: Merge pull request #1873 from varmenise/ JENKINS-30456 JENKINS-30456 Executable can be null in getEstimatedDurationFor Compare: https://github.com/jenkinsci/jenkins/compare/858849ef42ab...9bba7c5fa323

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: changelog.html http://jenkins-ci.org/commit/jenkins/bc254648870c1d7602b8218909b11c47d1cadb49 Log: Noting JENKINS-30456 from https://github.com/jenkinsci/jenkins/pull/1873

          dogfood added a comment -

          Integrated in jenkins_main_trunk #4329
          JENKINS-30456Executable can be null in getEstimatedDurationFor (Revision 67e2637a57be9b6817621dbfcdec2b2dc27afdb9)
          Noting JENKINS-30456 from https://github.com/jenkinsci/jenkins/pull/1873 (Revision bc254648870c1d7602b8218909b11c47d1cadb49)

          Result = SUCCESS
          valentina.armenise : 67e2637a57be9b6817621dbfcdec2b2dc27afdb9
          Files :

          • core/src/main/java/hudson/model/queue/Executables.java

          o.v.nenashev : bc254648870c1d7602b8218909b11c47d1cadb49
          Files :

          • changelog.html

          dogfood added a comment - Integrated in jenkins_main_trunk #4329 JENKINS-30456 Executable can be null in getEstimatedDurationFor (Revision 67e2637a57be9b6817621dbfcdec2b2dc27afdb9) Noting JENKINS-30456 from https://github.com/jenkinsci/jenkins/pull/1873 (Revision bc254648870c1d7602b8218909b11c47d1cadb49) Result = SUCCESS valentina.armenise : 67e2637a57be9b6817621dbfcdec2b2dc27afdb9 Files : core/src/main/java/hudson/model/queue/Executables.java o.v.nenashev : bc254648870c1d7602b8218909b11c47d1cadb49 Files : changelog.html

          Daniel Beck added a comment -

          varmenise Has your commit resolves this issue?

          In general, please remember to write [FIX JENKINS-12345] to indicate that. See https://wiki.jenkins-ci.org/display/JENKINS/contributing section "Commit Messages"

          Daniel Beck added a comment - varmenise Has your commit resolves this issue? In general, please remember to write [FIX JENKINS-12345 ] to indicate that. See https://wiki.jenkins-ci.org/display/JENKINS/contributing section "Commit Messages"

          valentina armenise added a comment - yes, this one https://github.com/jenkinsci/jenkins/commit/67e2637a57be9b6817621dbfcdec2b2dc27afdb9 . I forgot 'FIX' sry

            varmenise valentina armenise
            hadashi Ivan Meredith
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: