pytest-dev / pytest-dev/pytest-xdist

`gevent` execmode hangs in python 3.7.5

Đang mở
#653 0 bình luận 3 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
1.9k
Fork
288
Merge trung bình
9 giờ 30 phút
Pull request đã merge (30 ngày)
2

Mô tả

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện vấn đề bằng lệnh pytest được hiển thị và test.py trên Python 3.7.5, sau đó so sánh trace gỡ lỗi của execnet với hành vi trên Python 2. Trước tiên, hãy đọc issue execnet remote_exec được tham chiếu và đường dẫn gevent execmode; công việc được hoàn tất khi lệnh không còn bị treo trước khi thu thập test và báo cáo assertion thất bại như mong đợi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
distributed-systems, testing
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.