gh-142368: Refactor test_external_inspection to reduce flakiness in parallel execution#142369
gh-142368: Refactor test_external_inspection to reduce flakiness in parallel execution#142369pablogsal merged 2 commits intopython:mainfrom
Conversation
|
🤖 New build scheduled with the buildbot fleet by @pablogsal for commit 87fe775 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F142369%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
|
🤖 New build scheduled with the buildbot fleet by @pablogsal for commit 876cd0c 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F142369%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
…s in parallel execution The test file suffered from race conditions and resource exhaustion when running with multiple workers. The main culprit was test_async_global_awaited_by creating 1000 concurrent socket connections, which combined with parallel test execution could easily exhaust file descriptors. Reducing this to 100 tasks maintains test coverage while staying well within system limits. The refactoring consolidates duplicated socket setup, signal waiting, and subprocess cleanup patterns into module-level helpers with proper timeout and EOF handling. A base class now provides shared assertion methods for finding frames and threads in stack traces. The subprocess cleanup sequence was standardized to terminate first, then kill if needed, avoiding the previous inconsistent patterns that could leave zombie processes.
|
This is just a test refactor to ensure we don't randomly fail on slow machines (and reuse the same helpers that were added afterwards) |
|
🤖 New build scheduled with the buildbot fleet by @pablogsal for commit a358c1a 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F142369%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
The test file suffered from race conditions and resource exhaustion when
running with multiple workers. The main culprit was
test_async_global_awaited_by creating 1000 concurrent socket
connections, which combined with parallel test execution could easily
exhaust file descriptors. Reducing this to 100 tasks maintains test
coverage while staying well within system limits.
The refactoring consolidates duplicated socket setup, signal waiting,
and subprocess cleanup patterns into module-level helpers with proper
timeout and EOF handling. A base class now provides shared assertion
methods for finding frames and threads in stack traces. The subprocess
cleanup sequence was standardized to terminate first, then kill if
needed, avoiding the previous inconsistent patterns that could leave
zombie processes.