Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix _nextwid so that it handles graceful shutdown properly #634

Merged
merged 3 commits into from Nov 2, 2013
Merged

Fix _nextwid so that it handles graceful shutdown properly #634

merged 3 commits into from Nov 2, 2013

Conversation

scottkmaxwell
Copy link
Contributor

If you have a watcher with numprocesses=1 and send_hup=false, a reload causes the next wid to be None. Next reload puts it back to 1. Then back to None, etc.

The reason is that the _nextwid property is trying to find an available slot. Since graceful reload starts a new process first, then kills the old, the slots are all full. So _nextwid simply finishes, implicitly returning None.

What is worse, _nextwid would actual raise a RuntimeError if numprocesses > 1 and you try to do a graceful reload.

I rewrote the mechanism to use set unions. I made all_wids be numprocesses * 2 to handle the graceful reload case.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 89ad80b on scottkmaxwell:fix-nextwid into 44e8ad8 on mozilla-services:master.

@tarekziade
Copy link
Member

very cool - do you think we can add a test to demo the issue ?

@scottkmaxwell
Copy link
Contributor Author

Done. And I checked that it failed with the old code.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 84a4bf8 on scottkmaxwell:fix-nextwid into * on mozilla-services:master*.

@tarekziade
Copy link
Member

Fantastic!

tarekziade added a commit that referenced this pull request Nov 2, 2013
Fix _nextwid so that it handles graceful shutdown properly
@tarekziade tarekziade merged commit ac9f6da into circus-tent:master Nov 2, 2013
@scottkmaxwell scottkmaxwell deleted the fix-nextwid branch November 22, 2013 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants