You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Zipapp doesn't forward signals (SIGTERM and friends) to the process, resulting in orphaned processes and no cleanup #3809
Yes, the previous version in which this bug was not present was: ....
Unsure
Description
A clear and concise description of the problem...
When running a py_binary zipapp (E.g. bazel build --build_python_zip <tgt>) signals such as SIGTERM aren't forwarded to the binary itself, meaning the process doesn't get a chance to clean up.
import signal
signal.signal(signal.SIGTERM, lambda _1, _2: print("SIGTERM"))
while True:
pass
Then bazel run <tgt> and a kill -s TERM <pid> will print SIGTERM. But bazel build --build_python_zip <tgt> followed by a python <tgt>.zip and a kill -s TERM <pid> (of the outer process) results in the process being terminated and the underlying process being orphaned 💔
Activity
thejcannon commentedon Jun 4, 2026
From grepping around this may also affect
rules_python/python/private/python_bootstrap_template.txt
Line 500 in 25ad57c
rickeylev commentedon Jun 7, 2026
Yeah, this is a known issue. Properly forwarding the signals requires some subtle code.
Happy to have a PR for this. An LLM can probably figure it out relatively well.
jpneufeld commentedon Sep 15, 2026
@rickeylev I hit this so I had an llm post a fix
test(zipapp): isolate signal cases to POSIX
fix(zipapp): forward termination signals (bazel-contrib#4161)