Skip to content

Drop uWSGI threads, which silently disable harakiri - #860

Merged
f213 merged 2 commits into
masterfrom
drop-uwsgi-threads
Nov 27, 2026
Merged

f213 merged 2 commits into
masterfrom
drop-uwsgi-threads

Conversation

@f213

@f213 f213 commented Nov 27, 2026

Copy link
Copy Markdown
Member

--harakiri is armed per worker, not per request: uwsgi.workers[wid].harakiri is one field, set when a request starts and zeroed when any request on that worker finishes. With --threads=2, a sibling request completing on the other thread switches the timeout off under a request that is still running, so a worker with traffic never reaches its deadline. Threads also double the in-flight requests lost when a worker crashes.

Validation. Image built from this template, a WSGI app with a 12 s endpoint, --workers=1 --harakiri=3, four concurrent clients hitting a fast endpoint in parallel:

config slow request
--threads=2 200 after 12.03 s — never killed
no --threads killed after 3.02 s

In medical-backend (fandsdev/medical-backend#606) the longest server span in three weeks of traces was 310 s under --harakiri=25, and 504s arrived in exact pairs per worker segfault. It has run there without threads since August.

🤖 Generated with Claude Code

f213 and others added 2 commits November 27, 2026 12:25
harakiri is armed per worker, not per request: with two threads, a sibling
request finishing clears the deadline of the one still running, so a busy
worker never hits --harakiri. Threads also double the requests lost when
a worker dies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@f213
f213 merged commit 1cfb8d0 into master Nov 27, 2026
3 checks passed
@f213
f213 deleted the drop-uwsgi-threads branch November 27, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant