Zipapp doesn't forward signals (SIGTERM and friends) to the process, resulting in orphaned processes and no cleanup
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- python
- 领域
- build-system
调研方向
先从 python/private/zipapp/zip_main_template.py 的第279-281行附近开始,然后使用提供的信号处理 Python 程序复现该问题。将 bazel run 与执行构建出的 zipapp 进行比较,并验证 SIGTERM 能到达底层进程,使其能够完成清理而不会将其遗留下来成为孤儿进程。
由索引模型根据 Issue 内容生成。
描述
🐞 bug report
Affected Rule
The issue is caused by the rule: `py_binary`Is this a regression?
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.
I suspect https://github.com/bazel-contrib/rules_python/blob/25ad57c85f0094889520486cd9a5738278fd0541/python/private/zipapp/zip_main_template.py#L279-L281 is the source of the issue
🔬 Minimal Reproduction
Given
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 💔
🔥 Exception or Error
N/A
🌍 Your Environment
Operating System:
x64 Ubuntu
Output of bazel version:
Build label: 8.6.0
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Thu Feb 26 19:55:20 2026 (1772135720)
Build timestamp: 1772135720
Build timestamp as int: 1772135720
Rules_python version:
1.9.0
Anything else relevant?
- 主要语言
- Starlark
- 星标
- 690
- 派生
- 722
- 平均合并
- 1 天 55 分钟
- 30 天内合并 PR
- 38
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bazel-contrib/rules_python 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
bazel-contrib/rules_python#4179 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
bazel-contrib/rules_python#4164 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
bazel-contrib/rules_python#3821 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 45/100
bazel-contrib/rules_python#4181 ·
维护者通常 1 天内回复
-
Release 2.4.0未关闭type: release
难度 4/5 3-5 天 新手友好度 25/100
bazel-contrib/rules_python#4175 · 3 条评论 ·
维护者通常 1 天内回复
查看 bazel-contrib/rules_python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
block/artifact-swap#176 ·
-
area:lint-tooling bug
难度 2/5 1-3 小时 新手友好度 88/100
InauguralSystems/EigenScript#1340 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
Mend: dependency security vulnerability untriaged
难度 1/5 1 小时以内 新手友好度 88/100
opensearch-project/OpenSearch-Dashboards#12816 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复