Repository navigation
Description
Parents: #474, #482
Related: #480, #493, #885, #886, #887, #896
Source-level ownership finding
At 9fb57fa01035d7e5712f9283972cb92c48c26bef, both waitAsync completion paths remove their last completion record before a fallible Promise resolution whose error is discarded:
- Property-mode
settlePropAsynccallspromise.resolve(... ) catch {}after notify/expiry has detached its ticket fromg.prop_async, then unconditionally frees the ticket/key. Queue routing is protected against Thread exit, but root registration and settlement publication can still fail. - Shared-buffer
Interpreter.settleAsyncWaitersharvests the native outcome, removes the matching entry withtakeAsyncWaiter, callspromise.resolve(... ) catch {}, and finally abandons/clears remaining native/context waiter state.
Consequently, an allocation failure at completion can discard the sole notification/timeout outcome while leaving the already-exposed Promise pending. #885 makes an individual Promise publication transactional, but these callers currently discard the operation that would retry or complete that transaction. #896 owns reporting of unowned host-checkpoint errors; reporting alone cannot restore a destroyed waiter ticket.
This is a source audit, not yet a deterministic failing-allocator measurement.
Required implementation
- Give each admitted asynchronous waiter an exact completion/publication owner before exposing its result Promise.
- Preserve the harvested outcome and a precise, relocatable Promise root until resolution/rejection and required reaction publication commit. Do not free/drop the ticket or consume the last native outcome first.
- Evaluate reuse of Threads: make completion rooting and join settlement OOM-atomic #887's prepared settlement API, preserving the existing queue affinity, notify/timeout ordering, and worker-to-realm queue handoff from Microtasks: make queue transfer and restoration OOM-atomic #886.
- Make admission failure, not-equal/immediate-timeout paths, notify/expiry races, completion, cancellation, and Context/Thread teardown release each token/root/ticket exactly once.
- Preserve lock order across agent state, property waiters, Thread completion, queues, and Promise state. Do not resolve allocating work under a lock that GC/recovery must reacquire.
- No swallowed OOM, permanently pending orphan, duplicated outcome, callback replay, arbitrary waiter cap, emergency allocation pool, or global serialization.
Acceptance
- Deterministic fault witnesses cover property and shared-buffer waitAsync, notify and timeout, empty/full destination queues, and multiple harvested outcomes (including the fixed harvest-buffer boundary).
- Every failure proves exact native/context ticket membership, Promise state, reaction ownership, queue ordering, and eventual once-only completion after recovery.
- Moving/concurrent GC and bounded-heap recovery retain and rewrite detached completion roots through publication.
- No-GIL notify/timeout/Thread-exit races, teardown, relevant corpus cases, threadfuzz, full units, suppression-free TSan, and affected Test262/private ABI checks pass.
Security scope
Waiter fanout and memory pressure are script-controlled. This is engine state integrity under resource exhaustion, without adding an embedding sandbox or permission layer.
Activity
chrisbbreuer commentedon Sep 8, 2026
Additional source audit on
d4c2a63efound that the registration transaction must be fixed alongside completion:agent.abandonAsync(owner), removing every existing waiter for that owner rather than cancelling only the new ticket.agent.waitAsyncEnqueuecurrently maps native list/ticket allocation failures totimed_out. Resource failure must not manufacture a timeout outcome.These remain source-level findings; deterministic fault witnesses are still needed. The implementation should prepare exact admission/root/publication ownership, preserve primitive
ok/timed-outoutcomes through infallible commit, and cancel only the affected ticket. Queue reservations need explicit handling across worker exit: #886's transfer contract requires the source queue to have no live reservations. Simply carrying a token that still points at a destroyed worker queue would be incorrect.chrisbbreuer commentedon Sep 8, 2026
The property completion gap now has a deterministic failing-allocator witness: with fresh exhausted temporary-root storage and destination capacity already available,
settlePropAsyncconsumes/frees the detached ticket but leaves its Promise pending (expected .fulfilled, found .pending). The test reports no allocator leaks; the failure is lost completion ownership.An isolated candidate has passed initial Debug checks for shared-buffer completion under exhausted temporary-root storage, engine-list admission OOM preserving an older native waiter (the later notify still wakes exactly one), and intrinsic Promise/result-object semantics despite a replaced global Promise and inherited
async/valuesetters.This candidate is not landed or complete. Property completion still needs owned queue reservations across notify/timeout and Thread exit, together with precise roots for detached tickets. Native metadata-allocation fault coverage, moving-GC ownership, and the full no-GIL/TSan matrix remain to be verified. Work is isolated from the #885/#895 validation snapshot.
chrisbbreuer commentedon Sep 8, 2026
The isolated candidate now passes 16 focused Debug waitAsync tests, 0 failures, 0 leaks (
issue-897-fourth-probe.log). The previous deterministic property-completion witness now fulfills the exact target under exhausted temporary-root storage and publishes its dependent reaction.The candidate gives property waiters prepared local/host publication slots, an intrusive FIFO completion batch registered as an interpreter root before detachment, and a
join_mutex-protected owner index that includes detached tickets during Thread exit. Completion transfers/cancels each reservation without allocating and removes the precise root before freeing native metadata. Notify/expiry keep stable table compaction.New passing witnesses cover:
Two initial new fixtures incorrectly installed undefined detached handlers; those were corrected to ordinary dependent Promises before the 16/16 run. Additional native-admission allocation fault coverage and a GIL/no-GIL Thread-exit/notification race are now written but not yet compiled or run. ReleaseSafe, TSan, corpus, and broad acceptance remain outstanding; nothing in this comment closes the issue or claims those checks passed.
The ownership audit also found a separate current-Thread TLS lifetime/realm-entry concern, tracked as #905. Its description is explicitly a source finding pending a deterministic multi-Context witness.
fix(atomics): own waitAsync completion through publication (#897)
chrisbbreuer commentedon Sep 8, 2026
Landed and pushed as Chris: fix(atomics): own waitAsync completion through publication (#897). No co-author or other trailers.
Measured validation:
Full combined-suite/remaining fuzz/ABI acceptance stays open. Earlier #885/#895 broad validation completed lifecycle 3,360 programs and TSan default 60 programs without failures; those older-source results are recorded separately, not claimed as #897 validation. #896 now has measured primary-exception and moving-dispatch failures plus a passing initial isolated root fix; #905 has a measured wrong-Context Thread.current witness. Those follow-ups remain open.
chrisbbreuer commentedon Sep 9, 2026
Final integration verification for fix(atomics): own waitAsync completion through publication (#897) is complete on the pushed engine source in 0927912. The already-measured native/engine allocation faults, 33-outcome harvest boundary, nested moving roots, timeout/notify races, and Thread-exit reservation handoff now have full combined-suite and ABI coverage. The Context identity follow-up #905 is also fixed and closed.
Closing this transaction issue. The earlier local incomplete-sweep observation is preserved and remains under investigation in #907; #896's remaining private exception-box admission audit and #906's finalization cleanup ownership work remain separate open tasks. No timeout, workload, expected failure, or sanitizer suppression was relaxed to obtain this evidence.