-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add child_exit() callback to configuration #1394
Conversation
I will look at the patch. For your case why don't you clean the data when the worker is spawned though? |
We need the old worker's PID to do that |
This is similar to worker_exit() in that it is called just after a worker has terminated, but it's called in the Gunicorn *master* process, not the *child* process.
Rebased to latest master |
I deliberately split the changes into three commits to make them easier to understand |
Hey, what's the state of this? Is there anything I can do to have this merged? |
We need to use the recently added Gunicorn `child_exited` callback in order to correctly clean up after a segfaulted or OOM-killed worker (for details, see benoitc/gunicorn#1394).
We need to use the recently added Gunicorn `child_exited` callback in order to correctly clean up after a segfaulted or OOM-killed worker (for details, see benoitc/gunicorn#1394).
Add child_exit() callback to configuration
This adds a
child_exit()
callback to the Gunicorn configuration that works similar toworker_exit()
but is called in the master process instead of the child process.I also added some basic unit tests for the both.
A change to how
Worker.pid
is implemented was necessary in order for it to be meaningful in the master process (it would always be the PID of the master process, no information given about the worker process).Our need for this is prometheus/client_python#115