[FIX] runbot: workaround for nginx bug leaving orphan worker, blocking port

This commit is contained in:
Olivier Dony 2016-02-12 15:20:27 +01:00
parent 72bfc504cc
commit d9c9642675

View File

@ -418,7 +418,13 @@ class runbot_repo(osv.osv):
os.kill(pid, signal.SIGHUP)
except Exception:
_logger.debug('start nginx')
run(['/usr/sbin/nginx', '-p', nginx_dir, '-c', 'nginx.conf'])
if run(['/usr/sbin/nginx', '-p', nginx_dir, '-c', 'nginx.conf']):
# obscure nginx bug leaving orphan worker listening on nginx port
if not run(['pkill', '-f', '-P1', 'nginx: worker']):
_logger.debug('failed to start nginx - orphan worker killed, retrying')
run(['/usr/sbin/nginx', '-p', nginx_dir, '-c', 'nginx.conf'])
else:
_logger.debug('failed to start nginx - failed to kill orphan worker - oh well')
def killall(self, cr, uid, ids=None, context=None):
# kill switch