Cothread generates segmentation faults when run with Coverage
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 领域
- backend, testing-qa
调研方向
首先,在 Python 3.11 或更高版本下,使用文档中说明的 pytest 和 coverage 命令,通过 tests/test_crash.py 重现崩溃。然后检查 Cothread 的 PyThread_* API 交互,并将该故障与随附的 Valgrind 输出进行比较。当重现过程在 coverage 下完成且未发生 segmentation fault,并且已检查相关线程交互是否存在回归时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
In Python3.11+, it seems that Cothread is incompatible with Coverage. Attempting to run it will cause a segmentation fault during Pytest's cleanup stage, presumably at the stage when Coverage is doing its processing.
To recreate, create a Python3.11 virtual environment and add this program to the tests/ directory, named test_crash.py or simiar.
import cothread
def tick():
print("Test tick print!")
def tock():
print("Test tock print!")
def test_stuff():
t = cothread.Timer(0.1, tick)
cothread.Spawn(tock).Wait()
if __name__ == "__main__":
test_stuff()
Then run pytest -s --cov=cothread --cov-report term --cov-report xml:cov.xml tests/test_crash.py. You will see something similar to this:
$ pytest -s --cov=cothread --cov-rep
ort term --cov-report xml:cov.xml tests/test_crash.py
======================== test session starts ========================
platform linux -- Python 3.12.8, pytest-8.3.5, pluggy-1.5.0 -- /scratch/eyh46967/dev/cothread/venv/bin/python3.12
cachedir: .pytest_cache
rootdir: /scratch/eyh46967/dev/cothread
configfile: pyproject.toml
plugins: cov-6.1.1, anyio-4.9.0
collected 1 item
tests/test_crash.py::test_stuff Test tock print!
PASSEDFatal Python error: Segmentation fault
Thread 0x00007fbf91d02740 (most recent call first):
<no Python frame>
Thread 0x00007fbf91d02740 (most recent call first):
File Segmentation fault (core dumped)
A small amount of extra information can be gleaned from running the test under Valgrind: valgrind pytest -s --cov=cothread --cov-report term --cov-report xml:cov.xml tests/test_crash.py. See attached file.
At this time it is unknown if this is the only incompatibility with Cothread; it is possible other programs that do similar interactions with the various PyThread_* API calls will also suffer from issues or not.
- 主要语言
- C
- 星标
- 13
- 派生
- 11
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DiamondLightSource/cothread 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
DiamondLightSource/cothread#78 · 2 条评论 ·
-
bug
难度 4/5 3-5 天 新手友好度 35/100
DiamondLightSource/cothread#75 · 5 条评论 ·
-
难度 3/5 1-2 天 新手友好度 48/100
-
难度 4/5 3-5 天 新手友好度 35/100
DiamondLightSource/cothread#68 · 3 条评论 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 42/100
DiamondLightSource/cothread#67 · 2 条评论 ·
查看 DiamondLightSource/cothread 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 82/100
antoxa2584x/nfsu2-sw#44 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
codepointerapp/codepointer#231 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
kubernetes-sigs/security-profiles-operator#3597 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
ImageMagick/ImageMagick#9038 ·
维护者通常 1 天内回复