Repository navigation
test(corral): spawn the duckdb reopen child with posix_spawn, not fork - #255
Merged
Merged
Conversation
test_write_duckdb_while_a_reader_holds_the_file segfaulted (-11, no output) in ~40% of full parallel runs on macOS. Crash reports show the forked copy of the xdist worker dying before exec: fork runs PROJ's atfork-child handler (pyproj is loaded by the geo tests on the same worker), which closes cached SQLite handles and hits os_log, unsafe after fork on macOS. close_fds=False with the absolute sys.executable lets subprocess use posix_spawn, which runs no atfork handlers -- the same workaround as the node and documented-CLI tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
test_write_duckdb_while_a_reader_holds_the_file(added in #251) failed intermittently underpytest -n autoon macOS. The child that reopens the DuckDB file exited with -11 and produced no stdout or stderr.Cause. The failure had nothing to do with DuckDB locking or a shared instance. Every macOS crash report shows the same stack:
The forked copy of the xdist worker crashes before exec. pyproj/PROJ is loaded by the geo tests that run on the same worker, and it registers an atfork-child handler that closes its cached SQLite handles. On macOS, that close path calls
os_log, which is not safe to call after fork.subprocess.runwith the defaultclose_fds=Trueforks on macOS because the platform has noPOSIX_SPAWN_CLOSEFROM.Fix. Pass
close_fds=False(the executable,sys.executable, is already an absolute path) sosubprocessusesposix_spawn, which runs no atfork handlers. This is the same workaround therun_nodefixture, the project-cards harness and the documented-CLI contract tests already use. The change is test-only.Verification
Full suite,
uv run --all-extras pytest packages plugins -n auto -q -m "", macOS, Python 3.13.3:os.posix_spawn(the default call went through fork).ruff checkandruff format --checkare clean.🤖 Generated with Claude Code