pytest-xdist: pytest hangs while running tests
Hello everyone,
Last night I let my test suite running until this morning, but I noticed that it hasn’t finished running all tests, looking at htop
, I noticed some strange processes running for a really long time, as shown in this screenshot:
Looking at the tests output, I saw that the last ran tests were all ran by the same worker gw2
(there were 4 workers running), as there were 3 processes import sys;exec(eval(sys.stdin.readline()))
running for 13+ hours, I think that those 3 workers were just stuck somehow.
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 8
- Comments: 30 (12 by maintainers)
@nicoddemus I’m wondering if xdist should ensure to identify all currently running tests and their phases whenever a node exceeds a predetermined timeframe
An even further expansion of this might be printing stacktraces
The timeout Plugin tends to be a great Help for hangups
@JacobCallahan shot me more details at the work channel
I’m facing a very weird issue. When I run my test in parallel- Only 1 browser opens even when I execute pytest -n 2 After first test is successful, pytest just hangs and it does not even timeout Has anyone faced this issue?
py.test -vv -n 2 =================================================================================================== test session starts =================================================================================================== platform darwin – Python 3.7.3, pytest-5.4.1, py-1.10.0, pluggy-0.13.1 – ///* cachedir: .pytest_cache rootdir: //*, inifile: pytest.ini plugins: xdist-1.31.0, allure-pytest-2.8.40, repeat-0.9.1, forked-1.1.3, timeout-1.4.2 [gw0] darwin Python 3.7.3 cwd: //* [gw1] darwin Python 3.7.3 cwd: /**/* collected 8 items
[gw0] Python 3.7.3 (default, Apr 24 2020, 18:51:23) – [Clang 11.0.3 (clang-1103.0.32.62)] [gw1] Python 3.7.3 (default, Apr 24 2020, 18:51:23) – [Clang 11.0.3 (clang-1103.0.32.62)] gw0 [8] / gw1 [8] scheduling tests via MarkBasedScheduler
test1 [gw1] [ 12%] PASSED test1
It will get stuck after this.
Hey @telles-simbiose and @BlackHobbiT,
Did you manage to make it work? We suffer from the same issue. The test run hangs on 93%. All the workers are busy, only killing the process in task manager solves it, meaning let the run continue. When that worker is crushed, the report is also lost from that specific test.
Thanks
Try to use pytest-timeout, pytest --timeout=<timetoskip>, this will kill existing hang thread and move the execution for you.
Yeah, suffered from this issue sometimes. --fulltrace provide lock here
platform linux -- Python 3.6.1, pytest-5.0.1, py-1.5.3, pluggy-0.12.0 -- /usr/bin/python3.6 cachedir: .pytest_cache rootdir: /home/BlackHobbiT/path/to/test inifile: pytest.ini plugins: forked-1.0.2, xdist-1.29.0, allure-pytest-2.7.0 [gw0] linux Python 3.6.1 cwd: /home/BlackHobbiT/path/to/test [gw0] Python 3.6.1 (default, Sep 7 2017, 16:36:03) -- [GCC 6.3.0 20170406]