pytest-dev / pytest-dev/pytest-xdist
Time Before Session Starts Increases Exponentially With Number Of Workers
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 287
- Avg merge
- 9h 30m
- Merged PRs (30d)
- 2
Description
Hello,
I'm upgrading from Python 3.8 to Python 3.10. In my previous configuration, this was the pytest set up:
platform linux -- Python 3.8.6, pytest-3.10.1, py-1.9.0, pluggy-0.13.1
plugins: random-order-1.0.4, random-0.2, xdist-1.20.1, forked-1.3.0
It's a test suite with several thousands of tests. Using -n auto, everything was working fine on 32 workers.
Because of the upgrade, I had to upgrade also pytest and pytest-xdist. I tested a few versions, but I get the same problem with all of them. The current set-up:
platform linux -- Python 3.10.8, pytest-6.2.5, py-1.9.0, pluggy-0.13.1
plugins: xdist-2.0.0, forked-1.3.0, random-0.2, random-order-1.0.4
What happens is that between the pytest call and the start session message there is a gap of several minutes. Here's a list of minutes depending on the number of workers
1: 3:25
2: 5:48
3: 16:52
4: 17:27
8: 57:39
An example of the log:
build 28-Nov-2022 16:01:26 8
build 28-Nov-2022 16:59:05 ============================= test session starts ==============================
build 28-Nov-2022 16:59:05 platform linux -- Python 3.10.8, pytest-6.2.5, py-1.9.0, pluggy-0.13.1 -- /usr/local/bin/python
(8 is the number of workers, it's written by the same script that runs pytest right before it, like
echo "8"
pytest -v testSuite -n 8
With the old version, there was absolutely no time gap, while now it takes almost an hour just to start
Any insight of what might be the problem?
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 pytest -v testSuite -n 8 and the reported worker timings with the listed Python, pytest, and plugin versions. Compare startup behavior against the older configuration and isolate which upgrade or initialization phase causes the delay; done means identifying a reproducible cause and preventing the worker-count-dependent startup regression.
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
- Needs clarification
- Newbie friendliness
- 32/100