ansible-runner
ansible-runner copied to clipboard
Insufficient subprocess control and termination (SIGHUP)
It seems like ansible-runner is leaving running subprocesses behind (using ansible-runner as a Python module). Browsing through the code, this is a product of multiple bad design decisions (imo):
- The subprocess (pexpect) has
ignore_sighup=True
thus the subprocesses persists after parent process exits. There is no exposed options to change this behaviour. - The PID of the subprocess nor the underlying subprocess object itself is available to the end user.
- The
cancel_callback
is the only method of terminating the subprocess, but has a default timeout of 5 seconds (too much imho). Options to change default timeout of pexpect is not clearly documented (requires debugging/reading source code)
All in all, end users of this library are inherently expected to terminate ill-behaved subprocesses themselves (or say in case of the parent process exiting rapidly) but is left with limited options.