Commit 9e6ece7a authored by Julien Muchembled's avatar Julien Muchembled

Log signals that are sent to kill subprocesses and increase default log level

We currently have issues with OpenVPN hook scripts that aren't always killed
at exit. Such orphan processes prevent re6st from starting again (EADDRINUSE).

We want to know if it's an OpenVPN that does not exit cleanly on TERM,
or if it sometimes does not exit at all after 5s (then re6st sends a KILL
signal and at that point we should indeed make sure that any subprocess is
also KILLed).
parent 29d7fc03
......@@ -36,7 +36,7 @@ def getConfig():
help="Path to re6stnet state directory:\n"
"- cache.db: cache of network parameters and peer addresses\n"
"- babeld.state: see option -S of babeld\n")
_('-v', '--verbose', default=1, type=int, metavar='LEVEL',
_('-v', '--verbose', default=2, type=int, metavar='LEVEL',
help="Log level of re6stnet itself. 0 disables logging. 1=WARNING,"
" 2=INFO, 3=DEBUG, 4=TRACE. Use SIGUSR1 to reopen log."
" See also --babel-verb and --verb for logs of spawned processes.")
......
......@@ -155,6 +155,7 @@ exit = exit()
class Popen(subprocess.Popen):
def __init__(self, *args, **kw):
self._args = tuple(args[0] if args else kw['args'])
try:
super(Popen, self).__init__(*args, **kw)
except OSError, e:
......@@ -162,6 +163,11 @@ class Popen(subprocess.Popen):
raise
self.returncode = -1
def send_signal(self, sig):
logging.info('Sending signal %s to pid %s %r',
sig, self.pid, self._args)
super(Popen, self).send_signal(sig)
def stop(self):
if self.pid and self.returncode is None:
self.terminate()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment