Skip to content

fix: avoid race condition with parallel builds in shared cache#421

Merged
messense merged 1 commit intomainfrom
fix/parallel-build-race-condition
Feb 21, 2026
Merged

fix: avoid race condition with parallel builds in shared cache#421
messense merged 1 commit intomainfrom
fix/parallel-build-race-condition

Conversation

@messense
Copy link
Copy Markdown
Member

@messense messense commented Feb 21, 2026

Put all generated wrappers, symlinks, and cmake toolchain files in a per-exe subdirectory (wrappers/{exe_hash}/) so that parallel builds driven by different binaries (e.g. multiple maturin instances in separate temp venvs) never clobber each other.

  • Hash current_exe() path to create isolated subdirectory per binary
  • Move zigcc/zigcxx/zigranlib scripts, ar/lib/dlltool/install_name_tool symlinks, and cmake toolchain files into it
  • Extract resolve_current_exe() helper to deduplicate call sites
  • Derive dlltool PATH from zig_wrapper.ar parent instead of recomputing

Fixes #318
Closes #319

Put all generated wrappers, symlinks, and cmake toolchain files in a
per-exe subdirectory (`wrappers/{exe_hash}/`) so that parallel builds
driven by different binaries (e.g. multiple maturin instances in
separate temp venvs) never clobber each other.

- Hash `current_exe()` path to create isolated subdirectory per binary
- Move `zigcc`/`zigcxx`/`zigranlib` scripts, `ar`/`lib`/`dlltool`/`install_name_tool`
  symlinks, and cmake toolchain files into it
- Extract `resolve_current_exe()` helper to deduplicate call sites
- Derive dlltool `PATH` from `zig_wrapper.ar` parent instead of recomputing

Fixes #318
@messense messense force-pushed the fix/parallel-build-race-condition branch from b77c83a to 0428284 Compare February 21, 2026 12:10
@messense messense merged commit 4b77052 into main Feb 21, 2026
49 checks passed
@messense messense deleted the fix/parallel-build-race-condition branch February 21, 2026 12:46
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.

Sporadic failures with parallel builds through maturin

1 participant