Added log before waiting on threads #2556
Open
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.
Why do we need this log?
We manage a large Python application. once we started using the
max-requests
we noticed that clients are receiving502
during themax-request
reload.It is worth mentioning that we have 5x
uwsgi
processes, each with 70x threads.Our first step toward resolving this behavior was adding the
reload-mercy
/worker-reload-mercy
to grant our application 20 minutes to finish up the old requests and gracefully shut down the worker.This still didn't resolve our problem, and here we wanted to understand what is preventing our workers from shutting down gracefully.
In order to investigate it, we wanted to understand what happens inside our application before the reload to understand what is stuck and prevent our application from shutting down gracefully.
we compiled a version of
uwsgi
with this PR, and once we saw the new log message we knew this is our window (until themercy-reload
timeout) to dump the processstacktrace
(we usedpy-spy
) from the host.