Skip to content

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

Closed

Description

@jenkins-infra-bot

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)


Originally reported by hadashi, imported from: Executor.getIdleStartMilliseconds throws NPE when executor == null
  • assignee: varmenise
  • status: Resolved
  • priority: Minor
  • component(s): core
  • resolution: Fixed
  • resolved: 2015-11-17T14:12:32+00:00
  • votes: 0
  • watchers: 4
  • imported: 2025-11-24
Raw content of original issue

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)

Activity

  1. jenkins-infra-bot commented on Oct 17, 2015

    @jenkins-infra-bot
    Author
    scm_issue_link:

    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

  2. jenkins-infra-bot commented on Oct 17, 2015

    @jenkins-infra-bot
    Author
    scm_issue_link:

    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: 858849e...9bba7c5

  3. jenkins-infra-bot commented on Oct 17, 2015

    @jenkins-infra-bot
    Author
    scm_issue_link:

    Code changed in jenkins
    User: Oleg Nenashev
    Path:
    changelog.html
    http://jenkins-ci.org/commit/jenkins/bc254648870c1d7602b8218909b11c47d1cadb49
    Log:
    Noting JENKINS-30456 from #1873

  4. jenkins-infra-bot commented on Oct 17, 2015

    @jenkins-infra-bot
    Author
    dogfood:

    Integrated in jenkins_main_trunk #4329
    JENKINS-30456Executable can be null in getEstimatedDurationFor (Revision 67e2637)
    Noting JENKINS-30456 from #1873 (Revision bc25464)

    Result = SUCCESS
    valentina.armenise : 67e2637a57be9b6817621dbfcdec2b2dc27afdb9
    Files :

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

    o.v.nenashev : bc254648870c1d7602b8218909b11c47d1cadb49
    Files :

    • changelog.html
  5. jenkins-infra-bot commented on Nov 17, 2015

    @jenkins-infra-bot
    Author
    danielbeck:

    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"

  6. jenkins-infra-bot commented on Nov 17, 2015

    @jenkins-infra-bot
    Author
    varmenise:
    • Original comment link
    • Raw content of original comment:

      yes, this one 67e2637. I forgot 'FIX' sry

    yes, this one 67e2637. I forgot 'FIX' sry

  7. removed
    bugFor changelog: Minor bug. Will be listed after features
    on Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions