resque-pool doesn't shut down manager after kill -QUIT
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 456
- Forks
- 149
- Avg merge
- 9d 7h
- Merged PRs (30d)
- 3
Description
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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the kill -QUIT trap and its waitpid2 handling, then reproduce the shutdown with child processes that have been reaped. The change is complete when the manager exits after all known child processes are dead instead of waiting indefinitely; no specific test or file is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100