Found while stress-testing write barriers (main @ 09760e6, macOS arm64).
Repro (deterministic)
const src: any = {};
for (let i = 0; i < 3000; i++) {
src["f" + i] = { v: i };
}
console.log("built");
gc(); // never returns
console.log("gc done"); // never printed
Compile and run — the process prints built, then parks forever with ~0% CPU. sample shows the main thread blocked in __psynch_mutexwait via _pthread_mutex_firstfit_lock_slow (8 perry frames above it; release binary is stripped so I couldn't symbolicate which mutex).
Notes
- Needs the wide dynamic object (thousands of props added via
obj[key] = v, which spill to the OVERFLOW_FIELDS side table) + an explicit gc() call. Allocation-pressure-triggered GCs alone do not hang the same program.
- 3000-key object literals +
gc() are fine — only dynamically-added props trigger it.
OVERFLOW_FIELDS itself is a thread-local RefCell, so the deadlocked mutex is elsewhere (a RwLock/Mutex reached during the explicit-gc path, possibly lock-then-allocate-then-GC re-entry).
- This blocked a write-barrier stress repro; the stress test in
crates/perry/tests/gc_write_barrier_stress.rs deliberately avoids wide dynamic objects because of this hang.
Found while stress-testing write barriers (main @ 09760e6, macOS arm64).
Repro (deterministic)
Compile and run — the process prints
built, then parks forever with ~0% CPU.sampleshows the main thread blocked in__psynch_mutexwaitvia_pthread_mutex_firstfit_lock_slow(8 perry frames above it; release binary is stripped so I couldn't symbolicate which mutex).Notes
obj[key] = v, which spill to theOVERFLOW_FIELDSside table) + an explicitgc()call. Allocation-pressure-triggered GCs alone do not hang the same program.gc()are fine — only dynamically-added props trigger it.OVERFLOW_FIELDSitself is a thread-localRefCell, so the deadlocked mutex is elsewhere (aRwLock/Mutexreached during the explicit-gc path, possibly lock-then-allocate-then-GC re-entry).crates/perry/tests/gc_write_barrier_stress.rsdeliberately avoids wide dynamic objects because of this hang.