Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Zipapp doesn't forward signals (SIGTERM and friends) to the process, resulting in orphaned processes and no cleanup

未关闭
#3,809 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

bazel-contrib/rules_python 的其他 Issue

查看 bazel-contrib/rules_python 的全部 Issue

相似的 Issue

更多 Build System Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。