Repository navigation
fix(resolver): synchronize mutable entry-cache snapshots - #89
Merged
Merged
Conversation
Protect symlink slices and stat/fd cache snapshots with Guarded while preserving the existing entry lifecycle mutex. Add concurrent fill and re-stat regression coverage to Miri; the unpatched cache fails ThreadSanitizer.
Use explicit raw pointers and recognized safety comments in the concurrent cache tests. Clarify that the compatibility note covers cache snapshots.
This was referenced Oct 3, 2026
steipete
added a commit
that referenced
this pull request
Oct 5, 2026
Bound the macOS runtime transpiler cache to one write transaction at a time. Parallel file creation and rename contend inside APFS, spending kernel CPU across Bun Pool workers. Parsing, resolution, cache reads, cache bytes and atomic publication remain unchanged; resolver synchronization from #89/#94 is preserved. On the loaded arm64 Mac, 12 samples per arm in ABBA order reduce median system CPU from 5.340 to 1.505 seconds (71.8%) and hardware cycles from 24.838 to 11.343 billion (54.3%). Both bootstrap intervals exclude no change. Wall time is 1.805 to 1.890 seconds, a difference within the wide shared-host noise interval. All 352 SDK imports succeed and all 2,093 cache entries are byte-identical. Quiet Linux timings remain unchanged within run variation. Add a cold/warm module-import benchmark and concurrent symlink/cache-reuse coverage. Align stale hook-cache assertions with format 36 while preserving current-hook, changed-target and removed-target checks. Validation: 28 cache tests; 141 resolver/cache tests with two existing skips; all 12 Rust targets; native Linux and Darwin CI; scoped-clean Codex P2 review. CI: https://github.com/openclaw/bun/actions/runs/37246173137
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.
Concurrent worker resolution can read a torn symlink path from the process-global filesystem entry cache.
need_statpublishes a lazy fill, but it does not protect readers from later symlink fills, fd updates, or re-stats. A ThreadSanitizer test against the realEntrymethods reports the unlockedCell<EntryCache>::getracingset_cache_symlink(exit 66).Use Bun's existing
Guarded<EntryCache>for complete snapshots and field updates. The outer entry mutex still coordinates stat/fd lifecycle operations; lock order is outer entry mutex then cache mutex. Remove the manualEntrySend/Sync declarations. Two concurrent cache tests join the existing Miri runner; unrelated native-SIMD data-URL tests remain enabled outside Miri.Validation so far:
import override to bun:test); no sanitizer report.Scope and upstream: oven-sh#37274 explicitly left mutable-cache readers for follow-up. Open oven-sh#40258 fixes the separate
abs_pathpublication race, not this cache. The original consumer SIGSEGV has not recurred; the TSan cache race is the reproduced defect. A more aggressive native stress fixture also produces a JS module-not-found error with a directory-only resolved path on both baseline and patched binaries; this separate remaining resolution failure is not claimed fixed. The existing numeric-fd lifetime/close protocol is unchanged.Both fork native CI lanes passed on final head
b3412cd06ddc85b888e25b7c56d1f9bf94e0ff48: Linux x64 and Darwin arm64. Final-head Rust/Miri, format, JS lint, and source checks also passed. The resolver suite'simport override to bun:testfailure also reproduces on unpatched e167 and is unrelated to cache synchronization.