zero pids after worker killed due to --idle usage #217

merged 1 commit into from Sep 30, 2013


None yet
2 participants

prymitive commented Apr 8, 2013

It looks that worker pids are simply not zeroed after --idle kicks in, but maybe they should be zeroed somewhere else?

Also this SIGKILL seems brutal, isn't it possible that we be lucky enough to send SIGKILL just after new request was received? Wouldn't it be better to mark worker as ready for graceful shutdown (and each request would reset such marker) ?

uwsgi --wsgi-file tests/ -L -M --idle 2 -p 20 --http :8080 --cheaper 1 --cheaper-initial 10 --auto-procname  --stats :4444

is enough to test it, after idle check pids in stat socket


prymitive commented May 2, 2013

This is still needed:

$ ./uwsgi --wsgi-file tests/ -L -M --idle 2 -p 20 --http :8080 --cheaper 1 --cheaper-initial 10 --auto-procname  --stats :4444
*** Starting uWSGI 1.9.9 (64bit) on [Thu May  2 13:04:03 2013] ***
compiled with version: 4.4.3 on 02 May 2013 11:44:06
os: Linux-3.0.0-31-virtual #48~lucid1-Ubuntu SMP Tue Feb 5 13:45:18 UTC 2013
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 4
current working directory: /home/lukasz.mierzwa/uwsgi
detected binary path: /home/lukasz.mierzwa/uwsgi/uwsgi
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
uWSGI http bound on :8080 fd 4
uwsgi socket 0 bound to TCP address (port auto-assigned) fd 3
Python version: 2.6.5 (r265:79063, Oct  1 2012, 22:16:31)  [GCC 4.4.3]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x25d4970
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 1526448 bytes (1490 KB) for 20 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x25d4970 pid: 32424 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 32424)
spawned uWSGI worker 1 (pid: 32425, cores: 1)
spawned uWSGI worker 2 (pid: 32426, cores: 1)
spawned uWSGI worker 3 (pid: 32427, cores: 1)
spawned uWSGI worker 4 (pid: 32428, cores: 1)
spawned uWSGI worker 5 (pid: 32429, cores: 1)
spawned uWSGI worker 6 (pid: 32430, cores: 1)
spawned uWSGI worker 7 (pid: 32431, cores: 1)
spawned uWSGI worker 8 (pid: 32432, cores: 1)
spawned uWSGI worker 9 (pid: 32433, cores: 1)
spawned uWSGI worker 10 (pid: 32434, cores: 1)
*** Stats server enabled on :4444 fd: 50 ***
spawned uWSGI http 1 (pid: 32435)
workers have been inactive for more than 2 seconds (1367492647-1367492644)
cheap mode enabled: waiting for socket connection...

after all workers are cheaped stats socket still reports non-zero pids:

$ nc localhost 4444 | grep pid

prymitive commented Sep 30, 2013

this is still present, you can reproduce it with steps from my previous comments

@unbit unbit added a commit that referenced this pull request Sep 30, 2013

@unbit unbit Merge pull request #217 from prymitive/idle_fix
zero pids after worker killed due to --idle usage

@unbit unbit merged commit b50a377 into unbit:master Sep 30, 2013

prymitive deleted the prymitive:idle_fix branch Sep 30, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment