pytest-dev / pytest-dev/pytest-xdist
`gevent` execmode hangs in python 3.7.5
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 1.9k
- 派生
- 288
- 平均合并
- 9 小时 30 分钟
- 30 天内合并 PR
- 2
描述
The problem only occurs at python3.
Environment:
- OS:
Linux faa410b1f09b 4.19.121-linuxkit #1 SMP Thu Jan 21 15:36:34 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux - Python version:
Python 3.7.5
Dependencies:
apipkg 1.5
attrs 20.3.0
execnet 1.8.0
gevent 21.1.2
greenlet 1.0.0
iniconfig 1.1.1
packaging 20.9
pip 19.2.3
pluggy 0.13.1
py 1.10.0
pyparsing 2.4.7
pytest 6.2.3
pytest-forked 1.3.0
pytest-xdist 2.2.1
setuptools 41.2.0
toml 0.10.2
zope.event 4.5.0
zope.interface 5.4.0
Command: pytest -d --tx popen//execmodel=gevent test.py
Code:
from gevent import monkey
monkey.patch_all()
def test_assert_0():
assert 0
def test_assert_1():
assert 1
In Python 2 environment command runs all tests, reports failure on test_assert_0 and ends. In Python 3 environment test hangs before scanning for tests.
Execnet debug logs:
====================================== test session starts =======================================
platform darwin -- Python 3.8.2, pytest-6.2.3, py-1.10.0, pluggy-0.13.1
rootdir: /Users/changwan.park/Documents/py3_venv
plugins: xdist-2.2.1, forked-1.3.0
gw0 C[13946] gw0 [receiver-thread] RECEIVERTHREAD: starting to run
[13946] gw0 sent <Message CHANNEL_EXEC channel=1 lendata=8631>
[13946] gw0 sent <Message CHANNEL_DATA channel=1 lendata=470>
[13948] creating workergateway on <execnet.gateway_base.Popen2IO object at 0x10dc89bb0>
[13948] gw0-worker [serve] spawning receiver thread
[13948] gw0-worker [serve] joining receiver thread
[13948] gw0-worker waiting for receiver thread to finish
[13948] gw0-worker [receiver-thread] RECEIVERTHREAD: starting to run
[13948] gw0-worker [receiver-thread] received <Message CHANNEL_EXEC channel=1 lendata=8631>
[13948] gw0-worker [receiver-thread] received <Message CHANNEL_DATA channel=1 lendata=470>
Different issue compared with https://github.com/pytest-dev/execnet/issues/75. By comparing execnet debug trace, above example hangs after gw0-worker only receives gw0but does not execute the received command.
After some digging, I found out the hanging occurres since remote_exec hangs. See https://github.com/pytest-dev/execnet/issues/123.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
在 Python 3.7.5 下使用所示的 pytest 命令和 test.py 重现该问题,然后将 execnet 调试跟踪与 Python 2 下的行为进行比较。首先阅读所引用的 execnet remote_exec issue 和 gevent execmode 路径;当该命令在测试收集之前不再挂起,并报告预期的失败断言时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- distributed-systems, testing
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100