Skip to content

Fix hang with --dist=loadgroup if a crashed worker is replaced and there is still work to be done - #1328

Merged
RonnyPfannschmidt merged 2 commits into
pytest-dev:masterfrom
radoering:fix-other-loadgroup-hang
Sep 4, 2026
Merged

RonnyPfannschmidt merged 2 commits into
pytest-dev:masterfrom
radoering:fix-other-loadgroup-hang

Conversation

@radoering

Copy link
Copy Markdown
Contributor

Resolves #1327

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this workaround points to an need to rework sheduling a little better

@larsoner

larsoner commented Sep 3, 2026

Copy link
Copy Markdown

I can confirm that this fixes the crashes from #1327

@RonnyPfannschmidt
RonnyPfannschmidt merged commit eba6a44 into pytest-dev:master Sep 4, 2026
23 checks passed
davidheff added a commit to davidheff/pytest-xdist that referenced this pull request Sep 4, 2026
…lers

remove_node identifies the test the worker died on but leaves it flagged as
pending, so it returns to the workqueue with the rest of its work unit and the
replacement worker starts it again. A test that takes the interpreter down with
it takes the replacement down too, and the one after that, until
--max-worker-restart is spent and the run gives up, with the remainder of that
work unit never executed.

handle_crashitem has already reported the test as failed by then, so the retry
establishes nothing. LoadScheduling pops the crashed item for the same reason.

The two acceptance tests added in pytest-dev#1328 asserted the retry loop ("5 failed" for
a two-test file) and now assert the single failure.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GouFrDLBKB77gcu8Pp88r4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pytest --dist=loadgroup hangs if a crashed worker is restarted - variant 2

3 participants