Open klichukb opened 5 years ago
Friend of mine pointed out code that exactly doesn't call atexit if worker is busy. Is this correct? It means there are no guarantees that atexit is called since you cant know what load you're gonna get.
All time this hook worked unreliably. Moreover, it just not work in async mode. You can use as-user-atexit etc, but code will be executed in other address space.
// if busy do not run atexit hooks
is introduced in this commit.
https://github.com/unbit/uwsgi/commit/80be7385ed66d29eaf0cfa7a8f4399be6ad12b5c?diff=unified&w=1
I don't know why this line is necessary.
uwsgi 2.0.18
A python app (example.py):
uWsgi handler does somewhat CPU intensive work. Setup:
If I try to kill uwsgi master with SIGTERM I properly get 4 messages from workers:
Now I try to load the server, say, with "ab":
which should keep around 2 workers constantly busy and at high CPU usage, SIGTERM to master does not call atexit on these busy workers:
Does master still prioritize dispatching messages onto workers instead of running atexit? How is this behavior formally explained? Looks like under heavy load I can get 0 atexits called at all.
Same happens if using
atexit
module directly.