Skip to content
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

Log a warning when a worker was terminated due to a signal #2475

Merged
merged 1 commit into from Dec 17, 2020
Merged

Log a warning when a worker was terminated due to a signal #2475

merged 1 commit into from Dec 17, 2020

Conversation

aberres
Copy link
Contributor

@aberres aberres commented Dec 16, 2020

This happens for example when being OOM killed.

See #2215

This happens for example when being OOM killed.

See #2215
@aberres
Copy link
Contributor Author

aberres commented Dec 17, 2020

@benoitc @tilgovi Similar to the just merged #2277 this is a change which could make people running Kubernetes workloads a tad happier. Otherwise it is pretty hard to monitor OOM situations.

@benoitc
Copy link
Owner

benoitc commented Dec 17, 2020

which signal to who are we talking? Is kubernetes sending a SIGKILL signal? Anyway I am fine with such changes.

@benoitc benoitc merged commit 7ca05ec into benoitc:master Dec 17, 2020
@aberres
Copy link
Contributor Author

aberres commented Dec 17, 2020

which signal to who are we talking?

Kill.

When you have memory limits set in Kubernetes it can easily happen that a worker is shot down without any kind of logging/warning. Restarting works nicely, it is just that having a log eases the post mortem.

@benoitc
Copy link
Owner

benoitc commented Dec 17, 2020 via email

@aberres
Copy link
Contributor Author

aberres commented Dec 17, 2020

Yeah, that's an ongoing discussion of it should not send a SIGKILL immediately. But not likely to be changed as I understood the issues I was looking at.

More often than not when this situation arises it is likely a configuration issue and the requested memory should be increased.

Thanks a lot for the merge!

@tilgovi
Copy link
Collaborator

tilgovi commented Dec 17, 2020

K8s does send TERM for normal shutdown, but OOM killer in Linux always sends KILL, I think.

@CodeOnCoffee
Copy link

CodeOnCoffee commented Feb 2, 2022

@benoitc Why was this revered in: 76f8da2 ?

We have workers being silently OOMKilled in Kubernetes and would like to setup an alert based on the logs

@javabrett
Copy link
Collaborator

javabrett commented Feb 3, 2022

Why was this revered in: 76f8da2 ?

Due to reentrant logging calls when handling a signal during another logging call, as observed in #2564.

TomiBelan added a commit to TomiBelan/gunicorn that referenced this pull request Dec 20, 2022
Original: b695b49 (benoitc#2475)
Reverted: 76f8da2

The warnings are printed later in the main loop, not directly in the signal
handler. This should fix the RuntimeError from benoitc#2564.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants