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

queue.xml only gets persisted on successful shutdown

    XMLWordPrintable

Details

    Description

      So, if Jenkins doesn't shutdown properly, we lose the queueId. This is what we suspect as being the root case of the issue in JENKINS-30899

      Attachments

        Issue Links

          Activity

            tfennelly Tom FENNELLY created issue -
            tfennelly Tom FENNELLY made changes -
            Field Original Value New Value
            Link This issue is blocking JENKINS-30899 [ JENKINS-30899 ]
            tfennelly Tom FENNELLY added a comment - https://github.com/jenkinsci/jenkins/pull/1865
            kwhetstone Kristin Whetstone made changes -
            Link This issue is related to JENKINS-33926 [ JENKINS-33926 ]

            As part of an aside, I've been running tests on Jenkins 1.x and the 2 betas/rcs and am running into some interesting issues with saving the queue on Windows. If Jenkins is running as a process and it is stopped, it won't save a queue.xml. From looking at this pull request, this looks like it should have fixed the problem; are these cases related?

            kwhetstone Kristin Whetstone added a comment - As part of an aside, I've been running tests on Jenkins 1.x and the 2 betas/rcs and am running into some interesting issues with saving the queue on Windows. If Jenkins is running as a process and it is stopped, it won't save a queue.xml . From looking at this pull request, this looks like it should have fixed the problem; are these cases related?
            kwhetstone Kristin Whetstone made changes -
            Link This issue is related to JENKINS-34281 [ JENKINS-34281 ]
            jglick Jesse Glick added a comment -

            Is this simply a duplicate of JENKINS-34281, or is it discussing something else? I am not sure what precisely “we lose the queueId” means.

            jglick Jesse Glick added a comment - Is this simply a duplicate of JENKINS-34281 , or is it discussing something else? I am not sure what precisely “we lose the queueId” means.
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 166036 ] JNJira + In-Review [ 182257 ]
            tvail Tim Vail added a comment -

            Jesse – this appears to be an old issue. However, I'm finding a few issues with Jenkins and the queue persistence. Particularly on Windows.

            1. If you run Jenkins as a service then you restart the service (as opposed to telling Jenkins to exit) then there is no queue.xml created and the build queue is therefore lost.
            2. Prior situation means that if the machine is rebooted – we would probably lose the queue.
            3. Even more interesting – it appears that your fix somehow isn't working for /safeRestart or /restart. It is like /exit (which does save the queue.xml) is actually safer than /safeRestart.

            Considering all things – why don't we simply write queue.xml to the disk on every queue change? With today's HDD and SSD's – I'd think for most servers Jenkins is running on – the cost of doing so should be minimal. Compared to the writing of build logs to disk this is practically nothing. At least, why not make it an option to continuously persist the build queue (if so, then I'd think it should be on by default).

            tvail Tim Vail added a comment - Jesse – this appears to be an old issue. However, I'm finding a few issues with Jenkins and the queue persistence. Particularly on Windows. If you run Jenkins as a service then you restart the service (as opposed to telling Jenkins to exit) then there is no queue.xml created and the build queue is therefore lost. Prior situation means that if the machine is rebooted – we would probably lose the queue. Even more interesting – it appears that your fix somehow isn't working for /safeRestart or /restart. It is like /exit (which does save the queue.xml) is actually safer than /safeRestart. Considering all things – why don't we simply write queue.xml to the disk on every queue change? With today's HDD and SSD's – I'd think for most servers Jenkins is running on – the cost of doing so should be minimal. Compared to the writing of build logs to disk this is practically nothing. At least, why not make it an option to continuously persist the build queue (if so, then I'd think it should be on by default).
            oleg_nenashev Oleg Nenashev made changes -
            Link This issue is related to JENKINS-32820 [ JENKINS-32820 ]
            oleg_nenashev Oleg Nenashev added a comment -

            Queue persistence on Windows has been fixed in JENKINS-32820 (2.47, backported to 2.46.1). Not sure what else we can do in this ticket

            oleg_nenashev Oleg Nenashev added a comment - Queue persistence on Windows has been fixed in JENKINS-32820 (2.47, backported to 2.46.1). Not sure what else we can do in this ticket
            jglick Jesse Glick added a comment -

            In general the queue will change once per second, so writing it to disk every time may be unwise, but I agree it could be automatically persisted every minute or so.

            jglick Jesse Glick added a comment - In general the queue will change once per second, so writing it to disk every time may be unwise, but I agree it could be automatically persisted every minute or so.
            jglick Jesse Glick added a comment -

            An idea from svanoort (IIRC) was to have Queue.MaintainTask.doRun compare a Snapshot before and after maintain, and if they differ, call Queue.save; this would ensure that any changes to the queue are saved within five seconds and would be restored after a crash. Probably queue.xml.bak could be considered obsolete too.

            jglick Jesse Glick added a comment - An idea from svanoort (IIRC) was to have Queue.MaintainTask.doRun compare a Snapshot before and after maintain , and if they differ, call Queue.save ; this would ensure that any changes to the queue are saved within five seconds and would be restored after a crash. Probably queue.xml.bak could be considered obsolete too.
            cloudbees CloudBees Inc. made changes -
            Remote Link This issue links to "CloudBees Internal CJP-1708 (Web Link)" [ 19167 ]
            olivergondza Oliver Gondža made changes -
            Assignee Tom FENNELLY [ tfennelly ] Oliver Gondža [ olivergondza ]
            olivergondza Oliver Gondža added a comment - Proposing an alternative fix: https://github.com/jenkinsci/jenkins/pull/3244
            olivergondza Oliver Gondža made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            olivergondza Oliver Gondža made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]

            Code changed in jenkins
            User: Oliver Gondža
            Path:
            core/src/main/java/hudson/model/Queue.java
            test/pom.xml
            test/src/test/java/hudson/model/QueueRestartTest.java
            test/src/test/java/hudson/model/QueueTest.java
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/a/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/b/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/c/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/d/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/e/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/f/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/g/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/h/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/i/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/j/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/k/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/queue.xml
            http://jenkins-ci.org/commit/jenkins/72a7529a119b2be6b3ff93d63688ee6973404236
            Log:
            [FIX JENKINS-30909] Make sure queue is persisted reliably (#3244)

            • [FIX JENKINS-30909] Make sure queue is persisted reliably
            • Fix tests on Windows
            • Ensure Saver is thread-safe
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oliver Gondža Path: core/src/main/java/hudson/model/Queue.java test/pom.xml test/src/test/java/hudson/model/QueueRestartTest.java test/src/test/java/hudson/model/QueueTest.java test/src/test/resources/hudson/model/QueueTest/load_queue_xml/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/a/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/b/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/c/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/d/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/e/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/f/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/g/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/h/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/i/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/j/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/k/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/queue.xml http://jenkins-ci.org/commit/jenkins/72a7529a119b2be6b3ff93d63688ee6973404236 Log: [FIX JENKINS-30909] Make sure queue is persisted reliably (#3244) [FIX JENKINS-30909] Make sure queue is persisted reliably Fix tests on Windows Ensure Saver is thread-safe
            oleg_nenashev Oleg Nenashev added a comment -

            Fixed in 2.109. Likely it should be considered as a partial fix.
            olivergondza do you consider it as LTS candidate?

            oleg_nenashev Oleg Nenashev added a comment - Fixed in 2.109. Likely it should be considered as a partial fix. olivergondza do you consider it as LTS candidate?
            oleg_nenashev Oleg Nenashev made changes -
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]
            olivergondza Oliver Gondža made changes -
            Labels lts-candidate

            oleg_nenashev, certainly not for .1, adding the label to be reconsidered later.

            olivergondza Oliver Gondža added a comment - oleg_nenashev , certainly not for .1, adding the label to be reconsidered later.
            olivergondza Oliver Gondža made changes -
            Labels lts-candidate 2.107.2-fixed

            Code changed in jenkins
            User: Oliver Gondža
            Path:
            core/src/main/java/hudson/model/Queue.java
            test/pom.xml
            test/src/test/java/hudson/model/QueueRestartTest.java
            test/src/test/java/hudson/model/QueueTest.java
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/a/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/b/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/c/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/d/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/e/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/f/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/g/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/h/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/i/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/j/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/k/config.xml
            test/src/test/resources/hudson/model/QueueTest/load_queue_xml/queue.xml
            http://jenkins-ci.org/commit/jenkins/8c975f11c5a366b1693ed2be04e184a714cf2f84
            Log:
            [FIX JENKINS-30909] Make sure queue is persisted reliably (#3244)

            • [FIX JENKINS-30909] Make sure queue is persisted reliably
            • Fix tests on Windows
            • Ensure Saver is thread-safe

            (cherry picked from commit 72a7529a119b2be6b3ff93d63688ee6973404236)

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oliver Gondža Path: core/src/main/java/hudson/model/Queue.java test/pom.xml test/src/test/java/hudson/model/QueueRestartTest.java test/src/test/java/hudson/model/QueueTest.java test/src/test/resources/hudson/model/QueueTest/load_queue_xml/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/a/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/b/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/c/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/d/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/e/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/f/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/g/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/h/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/i/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/j/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/jobs/k/config.xml test/src/test/resources/hudson/model/QueueTest/load_queue_xml/queue.xml http://jenkins-ci.org/commit/jenkins/8c975f11c5a366b1693ed2be04e184a714cf2f84 Log: [FIX JENKINS-30909] Make sure queue is persisted reliably (#3244) [FIX JENKINS-30909] Make sure queue is persisted reliably Fix tests on Windows Ensure Saver is thread-safe (cherry picked from commit 72a7529a119b2be6b3ff93d63688ee6973404236)

            People

              olivergondza Oliver Gondža
              tfennelly Tom FENNELLY
              Votes:
              4 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: