Repository navigation
Add child_exit() callback to configuration - #1394
Merged
Merged
Conversation
Owner
|
I will look at the patch. For your case why don't you clean the data when the worker is spawned though? |
Contributor
Author
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.
Contributor
Author
|
Rebased to latest master |
tilgovi
approved these changes
Dec 21, 2016
Collaborator
Contributor
Author
I deliberately split the changes into three commits to make them easier to understand |
Contributor
Author
|
Hey, what's the state of this? Is there anything I can do to have this merged? |
benoitc
approved these changes
Jan 27, 2017
brian-brazil
pushed a commit
to prometheus/client_python
that referenced
this pull request
Mar 21, 2017
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).
mjjbell
pushed a commit
to mjjbell/gunicorn
that referenced
this pull request
Mar 16, 2018
Add child_exit() callback to configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.pidis 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