Issue Details (XML | Word | Printable)

Key: HUDSON-6804
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: mindless
Reporter: voorth
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Hudson

safeRestart should preserve build queue

Created: 21/Jun/10 05:15 AM   Updated: 23/Jul/10 12:09 PM   Resolved: 23/Jul/10 12:09 PM
Component/s: core
Affects Version/s: None
Fix Version/s: None


 Description  « Hide

After a restart, I get complaints from developers that their committed changes have not triggered. On a closer look, it turns out that the builds were already present in the build queue during restart. Saving the queue before restart would be a nice extension...



Sort Order: Ascending order - Click to sort in descending order
mindless added a comment - 23/Jun/10 05:16 PM

Hudson.java:2228 should save the queue contents.. I wonder if cleanUp() is somehow not called for safeRestart? cleanUp is called from WebAppMain.contextDestroyed().


voorth added a comment - 21/Jul/10 08:35 AM

Seems like it. With the safeRestart thread problems fixed in 1.367, I can confirm that after a safeRestart the build queue is empty.


mindless added a comment - 21/Jul/10 09:31 AM

Can you post steps to reproduce the problem in a new 1.367 install with no added plugins? Thanks.


voorth added a comment - 22/Jul/10 07:56 AM
  1. Create a 120 sec countdown job
  2. Set the number of executors to 1
  3. create two minimal jobs
  4. start the countdown job
  5. start the two small jobs
  6. http://<hudsonserver>/safeRestart
  7. after restart, the two pending jobs will not have been executed (you can tell by the build number)

mindless added a comment - 22/Jul/10 04:30 PM

thanks.. those steps did reproduce the issue for me.. I'll do some digging.


scm_issue_link added a comment - 23/Jul/10 12:09 PM

Code changed in hudson
User: : mindless
Path:
trunk/hudson/main/core/src/main/java/hudson/lifecycle/SolarisSMFLifecycle.java
trunk/hudson/main/core/src/main/java/hudson/lifecycle/UnixLifecycle.java
trunk/hudson/main/core/src/main/java/hudson/model/Hudson.java
trunk/www/changelog.html
http://hudson-ci.org/commit/33184
Log:
[FIXED HUDSON-6804] call Hudson.cleanUp from lifecycle classes and in Hudson.doSafeExit
so that safeRestart and safeExit propertly cleanup before terminating the process;
in particular, so the contents of the build queue is saved so it can be restored
after restart. Also increased delay before restart from 5 to 10 seconds,
as I saw one build get interrupted at restart in my testing.