progrium/ginkgo — pull request #76 by kelvl (2012-08-21 17:17:59+00:00)
Title: Fixes for SUID/SGID and SIGTERMs

Changed the order in which setuid and setgid is ran so that the process doesn't lose privilege to setgid after setuid completes

Removed recursive child.serve_forever() from serve_forever(),
this was creating a bug where a child service's serve_forever() blocks, because the loop runs sequentially, the child's siblings' serve_forever() doesn't yet run.

When stop() is issued on the parent, the child's serve_forever() finishes, and the sibling's serve_forever() is called, which starts the sibling again, leading to an inconsistent state and the process never dies. This leads to the parent ginkgo service to not respond correctly to SIGTERMs

I believe the serve_forever() loop is redundant, because self.state.wait('stopped') will have already be waiting for all child services to stop. The parent will only transition to stopped after all child services have stopped.