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

Harakiri in route does not work properly on GET requests #2680

Open
tomasz-stalmach opened this issue Sep 26, 2024 · 0 comments
Open

Harakiri in route does not work properly on GET requests #2680

tomasz-stalmach opened this issue Sep 26, 2024 · 0 comments

Comments

@tomasz-stalmach
Copy link

Versions used:

uwsgi=2.0.25.1
django=4.2.15
python=3.11.7

When I want to specify custom harakiri settings for one of my endpoints like this:

harakiri = 10
route = ^/api/batch/update/ harakiri:30

It does not work properly for GET requests.
When I send POST request on that endpoint, harakiri gets triggerred after 30 seconds, but when I send GET request, it gets triggered after 10 seconds, so global harakiri takes precedence over custom one set in route.

If I will not set global harakiri and leave just the one in route, it works properly for both GET nad POST requests.

Logs as an example:

{"event": "request_started", "request": "POST /api/batch/update/", "user_agent": "PostmanRuntime/7.41.2", "timestamp": "2024-09-26T14:50:40.311689Z"}
{"event": "request_finished", "code": 200, "request": "POST /api/batch/update/", "timestamp": "2024-09-26T14:51:05.395248Z"}

{"event": "request_started", "request": "GET /api/batch/update/", "user_agent": "PostmanRuntime/7.41.2", "timestamp": "2024-09-26T14:51:15.289798Z"}
{"source": "uwsgi", "type": "server", "time": "1727362286325119", "message": "Thu Sep 26 14:51:25 2024 - *** HARAKIRI ON WORKER 9 (pid: 26, try: 1, graceful: yes) ***"}
{"source": "uwsgi", "type": "server", "time": "1727362286325185", "message": "Thu Sep 26 14:51:25 2024 - HARAKIRI !!! worker 9 status !!!"}
{"source": "uwsgi", "type": "server", "time": "1727362286325226", "message": "Thu Sep 26 14:51:25 2024 - HARAKIRI [core 0] 10.1.6.105 - GET /api/batch/update/ since 1727362275"}
{"source": "uwsgi", "type": "server", "time": "1727362286325233", "message": "Thu Sep 26 14:51:25 2024 - HARAKIRI !!! end of worker 9 status !!!"}
{"source": "uwsgi", "type": "server", "time": "1727362286325242", "message": "Thu Sep 26 14:51:25 2024 - HARAKIRI triggered by worker 9 core 0 !!!"}
{"source": "uwsgi", "type": "server", "time": "1727362286325248", "message": "DAMN ! worker 9 (pid: 26) died, killed by signal 9 :( trying respawn ..."}

On both GET and POST requests I had simple blocking sleep function for 25 seconds. As we can see, POST request was not killed by harakiri, but GET was.

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

No branches or pull requests

1 participant