Search code examples
jenkinshudson

Jenkins - Problem: hudson.model.Queue$MaintainTask failed


I have a problem : (pending—Waiting for next available executor)

Console log:

Timer task hudson.model.Queue$MaintainTask@fb3e676 failed
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class hudson.slaves.NodeProperty (java.lang.Integer is in module java.base of loader 'bootstrap'; hudson.slaves.NodeProperty is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @7364985f)
at hudson.model.Node.canTake(Node.java:409)
at hudson.model.Queue$JobOffer.getCauseOfBlockage(Queue.java:276)
at hudson.model.Queue.maintain(Queue.java:1633)
at hudson.model.Queue$MaintainTask.doRun(Queue.java:2904)
at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:91)
at jenkins.security.ImpersonatingScheduledExecutorService$1.run(ImpersonatingScheduledExecutorService.java:58)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)

Solution

  • This looks to be related to a Jenkins bug: FATAL: java.lang.Integer cannot be cast to hudson.slaves.NodeProperty. Did you recently upgrade your Jenkins?

    • Go to the root folder of your Jenkins installation.
    • Look in config.xml for <globalNodeProperties>
    • If it looks like this, it probably wasn't correctly upgraded:
    <globalNodeProperties>
      <hudson.slaves.EnvironmentVariablesNodeProperty/>
      <int>2</int>
      <string></string>
      <string></string>
      ...
    </globalNodeProperties>
    
    • The XML format changed, it should look like this (Note that int is no longer a globalNodeProperty, a.k.a. the exception your are getting:
      <globalNodeProperties>
        <hudson.slaves.EnvironmentVariablesNodeProperty>
          <envVars serialization="custom">
            <unserializable-parents/>
            <tree-map>
              <default>
                <comparator class="hudson.util.CaseInsensitiveComparator" reference="../../../../../../views/listView/jobNames/comparator"/>
              </default>
              <int>2</int>
              <string></string>
              <string></string>
              ...
            </tree-map>
          </envVars>
        </hudson.slaves.EnvironmentVariablesNodeProperty>
      </globalNodeProperties>