Skip to content

Conversation

@0xkems
Copy link

@0xkems 0xkems commented Feb 2, 2026

Summary

Background

The original issue reported that when using Polars with timeout protection that directly terminates processes via native code, pytest-xdist doesn't report the failure. This is because such terminations bypass Python's exception handling, and previously the error message would only say "Not properly terminated".

Changes

  • Added _get_worker_exit_code() method to WorkerController that safely retrieves the worker process exit code via the execnet gateway
  • Modified process_from_remote() to check the exit code when the channel closes unexpectedly
  • If a non-zero exit code is found, it's included in the error message (e.g., "Worker exited with non-zero exit code: 42")

Test plan

  • Added new test test_exit_code_reported_in_error that verifies exit codes are reported
  • Verified existing crash tests still pass
  • Verified all test_workermanage.py tests pass

🤖 Generated with Claude Code

)

When a worker process terminates with a non-zero exit code (e.g., via
native code calling exit() directly), the exit code is now included in
the error message. This helps diagnose crashes that bypass Python's
exception handling mechanism.

Previously, such cases would only report "Not properly terminated",
making it difficult to determine the actual cause of the crash.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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.

If a worker exits with a non-zero status code pytest-xdist doesn't report failure

1 participant