I have faced a quite sad situation. Master was so ashamed of the code
his worker was running, that it killed itself.

Relevant config options:

------8<------8<------8<------8<------8<------8<------
master = true
; nginx kills connection after 60s
harakiri = 65
harakiri-verbose = true
reload-mercy = 65

workers = 4
threads = 25

lazy = true
; kill workers if there are no requests at all for 90 seconds keeping one
; worker alive as a `hot cache`
cheaper = 1
idle = 90
------8<------8<------8<------8<------8<------8<------

I suspect `cheaper` option. I see following in logs:

*** HARAKIRI ON WORKER 3 (pid: 0) ***
Thu Feb  9 11:53:59 2012 - uWSGI worker 1 screams: UAAAAAAH my master
died, i will follow him...
Thu Feb  9 11:53:59 2012 - uWSGI worker 1 screams: UAAAAAAH my master
died, i will follow him...

It's quite brutal to kill(0, SIGBLAH), "If pid equals 0, then sig is
sent to every process in the process group of the calling process."
I've not seen same issue after following patch:

------8<------8<------8<------8<------8<------8<------
diff -r 3f88229ad41d master.c
--- a/master.c  Wed Feb 01 17:55:33 2012 +0100
+++ b/master.c  Sun Feb 12 14:50:38 2012 +0700
@@ -1671,6 +1671,7 @@
                        if (uwsgi.workers[uwsgi.mywid].cheaped == 1) {
                                uwsgi.workers[uwsgi.mywid].pid = 0;
                                uwsgi_log("uWSGI worker %d cheaped.\n", 
uwsgi.mywid);
+                               uwsgi.workers[uwsgi.mywid].harakiri = 0;
                                continue;
                        }
                        gettimeofday(&last_respawn, NULL);
------8<------8<------8<------8<------8<------8<------

I'm unsure if it's correct way to patch the code, but it seems to be
so. Do you have any comments?


--
WBRBW, Leonid Evdokimov
xmpp:[email protected] && http://darkk.net.ru
tel:+79816800702 && tel:+79050965222
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to