Uwsgi: Sending SIGHUP to process doesn't release SysV semaphores

Created on 4 Apr 2017  路  4Comments  路  Source: unbit/uwsgi

Gracefully killing workers does not release SysV ipc semaphores. The new process opens up a new set, and the system will eventually run out.

SIGINT cleans up correctly
SIGTERM and SIGHUP leave orphaned semaphores
SIGKILL - I'd expect it to leave them

System: OpenBSD 6.1
uwsgi 2.0.14 and 2.0.15

Most helpful comment

I have noticed that the ftok option helps. It has to, however, be set per vassal. I've adjusted the config in each vassal to:

pidfile = /path/%n.pid
ftok = /path/%n.pid

I have added this here in case someone else bumps into this issue with SysV Semaphores

All 4 comments

Have been observing the same as well.

  • OpenBSD www.local 6.1 GENERIC.MP#6 amd64
  • uWSGI 2.0.15 from PyPI

uWSGI running with master mode, calling the rc.d(8) script with _reload_ argument sends SIGHUP via _rc_reload_ and results in compounding number of semaphores:

$ ipcs -a |egrep -c nobody                             
32                                                                           
$ doas /etc/rc.d/uwsgi_moin_home reload                
uwsgi_moin_home(ok)                                                           
$ ipcs -a |egrep -c nobody                           
40
$ doas /etc/rc.d/uwsgi_moin_home reload
uwsgi_moin_home(ok)
$ ipcs -a |egrep -c nobody
48
$ doas /etc/rc.d/uwsgi_moin_home reload
uwsgi_moin_home(ok)
$ ipcs -a |egrep -c nobody
56

Does adding "vacuum = True" to the options, fixes the issue ?

According to the docs, vacuum is for cleaning files/sockets. It changes nothing with respect to this issue (And I had already tried it out for 'just-in-case' ;-)

I have noticed that the ftok option helps. It has to, however, be set per vassal. I've adjusted the config in each vassal to:

pidfile = /path/%n.pid
ftok = /path/%n.pid

I have added this here in case someone else bumps into this issue with SysV Semaphores

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yoichi picture yoichi  路  7Comments

GaretJax picture GaretJax  路  7Comments

aperigault picture aperigault  路  7Comments

ilrico picture ilrico  路  7Comments

jordanmclain picture jordanmclain  路  5Comments