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

Jenkins build queue is cleared after restart (regression in 2.333)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • Jenkins 2.332.2 LTS JDK11
    • 2.343

      After a Jenkins update from 2.319.3 LTS to 2.332.2 LTS we have noticed that when shutting down the Jenkins docker container the build queue is no longer preserved and all scheduled builds are lost when starting Jenkins again. When rolling back to 2.319.3 it is working again as expected.

      Observed behavior:

      • Jenkins build queue (/var/jenkins_home/queue.xml) is cleared when shutting down the jenkins container

      Expected behavior:

      • Jenkins build queue is preserved in /var/jenkins_home/queue.xml when shutting down the jenkins container and loaded at the next Jenkins startup

       

      #########
      #Steps to reproduce
      #########

      1. Run the Jenkins docker container with tag 2.332.2-lts-jdk11

      docker run -d --name jenkins -p 8080:8080 -p 50000:50000 --restart always -v jenkins_home:/var/jenkins_home jenkins/jenkins:2.332.2-lts-jdk11

       

      2. Install the "Schedule Build" plugin

      3. Create a simple testjob

      4. Navigate to the created testjob. Press the "Schedule Build" button. Then enter a time and date which is in the future (i.e. in 1 hour) and press "Schedule". You will see a job in the build queue waiting to be executed at the time you have entered before.

      5. Monitor the file /var/jenkins_home/queue.xml wherever you have mounted the volume outside the container. The queue.xml isn't created immediately, but should be created within a minute after the job has been scheduled and has the information of your scheduled build.

      <?xml version='1.1' encoding='UTF-8'?>
      <hudson.model.Queue_-State>
        <counter>18</counter>
        <items>
          <hudson.model.Queue_-WaitingItem>
            <actions>
              <hudson.model.CauseAction>
                <causeBag class="linked-hash-map">
                  <entry>
                    <hudson.model.Cause_-UserIdCause>
                      <userId>admin</userId>
                    </hudson.model.Cause_-UserIdCause>
                    <int>1</int>
                  </entry>
                </causeBag>
              </hudson.model.CauseAction>
            </actions>
            <id>18</id>
            <task class="hudson.model.FreeStyleProject">testjob</task>
            <inQueueSince>1649775922437</inQueueSince>
            <timestamp>
              <time>1649800801433</time>
              <timezone>Etc/UTC</timezone>
            </timestamp>
          </hudson.model.Queue_-WaitingItem>
        </items> 

      6. Stop the Jenkins container

      docker stop jenkins

      7. Monitor /var/jenkins_home/queue.xml in your volume mount again. The file has been altered, and the information for the scheduled job inside the xml structure is gone

      <?xml version='1.1' encoding='UTF-8'?>
      <hudson.model.Queue_-State>
        <counter>18</counter>
        <items/>
      </hudson.model.Queue_-State>

      8. Start the Jenkins container

      docker start jenkins

      9. Jenkins Build queue is empty

       

        1. image-2022-04-12-17-21-39-066.png
          63 kB
          Christian Stoff
        2. image-2022-04-12-17-32-12-621.png
          27 kB
          Christian Stoff

            basil Basil Crow
            chri4774 Christian Stoff
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: