馃И test(fork): fork once the event loop has closed - #714
Open
gaborbernat wants to merge 1 commit into
Open
Conversation
The canceled-acquire test forked from inside the coroutine, right after awaiting shutdown_default_executor(). Thread.join() returns once the interpreter releases the thread state, while the OS thread is still unwinding, and NetBSD deadlocks a child forked from a process that still carries one, so the fork wedged and the 10s subprocess timeout killed it (tox-dev#707). Move the descriptor swap and the fork to module scope, after asyncio.run has closed the loop, leave the worker time to go, and report a thread that is still counted rather than forking on it. Raise the subprocess timeout to 30s so a slow builder is not the failure mode either.
|
I've tested 3.32.3 with this patch applied on top, and get |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #707.
test_cancelled_async_acquire_unregisters_reused_descriptorforks from inside the coroutine, one statement afterawait loop.shutdown_default_executor(). That await joins the executor worker the canceled acquire left behind, butThread.join()returns as soon as the interpreter releases the thread state, while the OS thread is still unwinding. NetBSD deadlocks a child forked from a process that still carries one, so the fork wedges,os.waitpidnever returns, and the 10 second subprocess timeout kills the interpreter with SIGKILL. That is thereturncode: -9in the report.The descriptor swap and the fork move to module scope, after
asyncio.run()has closed the loop and the runner has shut the executor down. The script then leaves the worker time to go and checksthreading.active_count(), exiting 6 rather than forking on a thread that is still counted. The subprocess timeout goes to 30 seconds so a slow builder is not the failure mode either.I have no NetBSD machine, so this is reasoned from the report rather than reproduced: the run reaches the fork and hangs there, and the window between the join and the fork is the only NetBSD-specific thing in the script. @0-wiz-0, could you run the suite with this branch? If it still fails, exit code 6 says a thread outlived the loop, and any other outcome puts the deadlock elsewhere, where a backtrace of the wedged process would tell us where.