Concurrent crafter-build invocations corrupt the shared module cache (malformed or corrupted precompiled file) #15
No reviewers
Labels
No labels
bug
claude:done
claude:failed
claude:in-progress
claude:ready
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Catcrafts/Crafter.Build!15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/issue-14"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Done. Summary:
Root cause —
BuildStdPcmandEnsureCrafterBuildPcmswrote PCMs directly to shared paths underXDG_CACHE_HOME/<target>-<march>/. Twocrafter-buildinvocations sharing the cache would clobber each other, and readers via-fprebuilt-module-pathsaw torn bytes →malformed or corrupted precompiled file: 'can't skip to bit X from Y'.Fix — added
MakeTempPcmPath+CommitPcmhelpers inCrafter.Build-Platform.cpp. All 6 PCM write sites (3 platforms × {BuildStdPcm,EnsureCrafterBuildPcms}) now precompile to<final>.tmp.<pid>.<seq>and atomic-rename into place. The mingw-on-Linux std.cppm copy is per-PID for the same reason.CommitPcmtolerates a parallel rename winning the race as long as the destination ends up valid.Verification
ConcurrentCacheRaceregression test that races fourLoadProject()calls against a scratch cache — triggers the race 5/5 without the fix, passes 5/5 with it.Committed as
96d1df9onclaude/issue-14.Resolves #14 — autonomous claude-podman run.