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

resque-pool doesn't shut down manager after kill -QUIT #107

Open
wollkind opened this issue Mar 10, 2014 · 0 comments
Open

resque-pool doesn't shut down manager after kill -QUIT #107

wollkind opened this issue Mar 10, 2014 · 0 comments

Comments

@wollkind
Copy link

I believe there is a bug in the handling of kill -QUIT that causes the manager to hang after all the processes are reaped. The issue is that the trap for kill -QUIT passes a zero as the flag to waitpid2, which is sensible since we do want to wait for all the child processes to end before shutting down the manager. Unfortunately this causes a hang after all the children have finished because a call waitpid2 with a flag value of zero and no living children will never return. It seems an assumption was made that this call would just return a nil pid after all children have ended but that is not the case per the Ruby docs and some experimentation. (In fact, the Ruby docs say that a waitpid2 with no children can result in a SystemError on some platforms, but this does not seem to be the case on OSX or Centos for me)

I think this code needs to be rewritten to instead wait for a known set of child pids to report that they are dead and then exit the loop. For now, kill -INT works just fine for my purposes (I'm ok with god starting up a new master before all old workers are finished)

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

No branches or pull requests

1 participant