Type
bug
Severity
medium
Area
nmapui/jobs.py — job cancellation logic
Description
When a scan job is cancelled, the code sends process.terminate() (SIGTERM) but never escalates to process.kill() (SIGKILL) if the process does not exit. Nmap can sometimes ignore SIGTERM (particularly during certain NSE script phases), leaving zombie processes consuming resources.
if process and process.poll() is None:
try:
process.terminate()
except Exception:
logger.exception("...")
Proposed Fix
Add a timeout-and-kill escalation:
if process and process.poll() is None:
try:
process.terminate()
try:
process.wait(timeout=5)
except subprocess.TimeoutExpired:
logger.warning("Process %s did not exit after SIGTERM, sending SIGKILL", process.pid)
process.kill()
process.wait(timeout=3)
except Exception:
logger.exception("Failed to terminate process")
Related Issues
#195 (Menu bar close must kill all app instances)
Type
bug
Severity
medium
Area
nmapui/jobs.py— job cancellation logicDescription
When a scan job is cancelled, the code sends
process.terminate()(SIGTERM) but never escalates toprocess.kill()(SIGKILL) if the process does not exit. Nmap can sometimes ignore SIGTERM (particularly during certain NSE script phases), leaving zombie processes consuming resources.Proposed Fix
Add a timeout-and-kill escalation:
Related Issues
#195 (Menu bar close must kill all app instances)