Open rcrowley opened 13 years ago
I hope this works.
https://github.com/rcrowley/upstartable-nginx is actually a pretty good and pretty generic solution to this problem. So maybe the work should be done outside goagain
?
This is to deal with upstart and runit (I think is ubuntu and arch). SystemD base systems (like redhat* and seems like debian now) solve this problem by using process groups. So the daemon is not consider died until there are no more process of the same group.
Don't know which is the perfect solution, but on any case, I think should be outside the scope of this lib.
The Double strategy solves this issue.
How experimental is that experimental Double strategy ? Anyone has experience with it ?
After talking with Paul Hammond, the following scheme would make Goagain Upstart-friendly:
Open the
*net.TCPListener
in the parent process and then fork a child process. The child process execs and begins accepting connections on the inherited*net.TCPListener
.When signaled
SIGUSR2
, the parent forks a new child. The child process execs, which loads new code from disk, and resumes accepting connections on the inherited*net.TCPListener
. When this new child is operational, it signals the old childSIGQUIT
to exit gracefully.The parent process should only exit on
SIGTERM
and the like.