pytest-dev / pytest-dev/pytest-xdist
xdist master freezes if socketserver worker calls pytest.exit()
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 287
- Avg merge
- 9h 30m
- Merged PRs (30d)
- 2
Description
- test_exit.py
import pytest
def test_a():
pass
def test_b():
pytest.exit('system state unrecoverable, destroy pytest session.')
-
socketserver https://bitbucket.org/hpk42/execnet/raw/2af991418160/execnet/script/socketserver.py
-
expected:
pytest -d --tx socket=localhost:8888 test_exit.py --rsyncdir=.should not freeze -
observed: it freezes until Ctrl+C is input.
--tx ssh=localhostis fine.
-
log
root@0fa7f92c43b4:~# pytest -d --tx socket=localhost:8888 test_exit.py --rsyncdir=. # socketserver
==================================================================================== test session starts =====================================================================================
platform linux2 -- Python 2.7.13, pytest-4.6.9, py-1.8.1, pluggy-0.13.1
rootdir: /root
plugins: xdist-1.31.0, forked-1.1.3
gw0 [2]
.[gw0] node down: keyboard-interrupt
f
replacing crashed worker gw0
^C ### pytest freezes until I input Ctrl+C
========================================================================================== FAILURES ==========================================================================================
_____________________________________________________________________________________ root/test_exit.py ______________________________________________________________________________________
[gw0] linux2 -- Python 2.7.13 /usr/bin/python
worker 'gw0' crashed while running 'root/test_exit.py::test_b'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/usr/local/lib/python2.7/dist-packages/execnet/gateway_socket.py:28: KeyboardInterrupt
(to show a full traceback on KeyboardInterrupt use --fulltrace)
============================================================================= 1 failed, 1 passed in 2.58 seconds =============================================================================
root@0fa7f92c43b4:~# pytest -d --tx ssh=localhost test_exit.py --rsyncdir=. # ssh
==================================================================================== test session starts =====================================================================================
platform linux2 -- Python 2.7.13, pytest-4.6.9, py-1.8.1, pluggy-0.13.1
rootdir: /root
plugins: xdist-1.31.0, forked-1.1.3
gw0 [2]
.[gw0] node down: keyboard-interrupt
f
replacing crashed worker gw0
gw1 C
========================================================================================== FAILURES ==========================================================================================
_____________________________________________________________________________________ root/test_exit.py ______________________________________________________________________________________
[gw0] linux2 -- Python 2.7.13 /usr/bin/python
worker 'gw0' crashed while running 'root/test_exit.py::test_b'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: <WorkerController gw0> received keyboard-interrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================= 1 failed, 1 passed in 1.08 seconds =============================================================================
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the command from test_exit.py with the socketserver target, then compare it with the working ssh target. Inspect execnet's socketserver.py and the xdist worker-handling path to identify why pytest.exit leaves the socket run frozen. Done means the socket command finishes without requiring Ctrl+C and the regression is covered by the reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- distributed-systems, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100