GeezerVison is showing github.com — Order Atomics notifies against waits and their timeouts when recording by Andarist · Pull Request #191 · replayio/node
Conversation
Andarist
commented
Oct 23, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Whether an Atomics.notify woke a waiter, and which one, was decided under FutexEmulation's g_mutex with events disallowed, so nothing recorded it. A replay could therefore pick a different outcome than the recording:
- Timeouts: a waiter's timeout and a notify racing for it. This covers the
waitAsync timeout task, and WaitSync deciding against the clock.
- Entering the list: whether a waiter had entered the wait list when a notify ran, and in which order two waiters on one address entered it.
- Teardown: a notify racing a worker's isolate going away (
IsolateDeinit).
- Value check: what value a wait found. The program's own stores to the shared memory aren't recorded.
- Collected waiters:
Wake cancelled the timeout task of an async waiter whose buffer and context had been collected, when a new buffer landed at the old address and was notified. That depends on the collector and the allocator.
While recording or replaying, these steps take one ordered lock, created at record/replay init:
Wake, HandleAsyncWaiterTimeout and IsolateDeinit take it.
WaitAsync holds it across its value check and insertion.
WaitSync takes it twice. First across its value check and insertion. Then again on every exit from the wait, to leave the list and re-decide a timeout. A notify that took the lock first wins even after the deadline.
Whether the value check found another value is recorded with RecordReplayValue, and the replay uses the recorded answer. The value is still read under g_mutex, as upstream does; events are allowed only around recording the answer.
WaitSync leaves its disallow scope around each lock take and release, because OrderedLock/OrderedUnlock do nothing while events are disallowed.
A collected waiter with a timeout task is left for that task to clean up, as upstream already does whenever no notify lands at its address. Otherwise the task would take the ordered lock on one side only.
Every wait therefore takes the lock the same number of times in the recording and the replay, so a divergence shows up as a mismatch, never a hang.
AutoOrderedLock moves into v8.h next to OrderedLock, as in the Chromium V8 fork, replacing the copy in the wasm module compiler.
When not recording or replaying, the lock id is 0 and nothing changes beyond a few flag checks. While recording, the lock costs about 1,000 instructions per notify or wait.
Tested with replayio/backend's node-recording cases from nodejs#13595 and nodejs#13606, plus the collected-waiter case on andarist/atomics-wait-collected-waiter-case. Each fails on master or on an earlier state of this branch, and passes 4/4 with it:
worker-threads/atomics-wait-{async-,}timeout-notify-race
worker-threads/atomics-wait-{async-,}two-waiters-notify-one
worker-threads/atomics-wait-{async-,}store-notify-race
worker-threads/atomics-wait-async-notify-terminating-worker: also fails 4/4 with this branch minus the IsolateDeinit lock.
gc/atomics-wait-async-collected-context: passes on master, which has no ordered lock. It fails 4/4 with this branch before its last commit.
The existing worker-thread, Atomics and webassembly cases still pass.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Whether Atomics.notify woke an async waiter or its timeout task timed it
out first was decided under g_mutex with events disallowed in both Wake and
HandleAsyncWaiterTimeout, so nothing recorded which came first and a replay
could pick the other: the worker's timeout task resolved the promise with
"timed-out" where the recording's had found it already notified, or the
main thread's notify woke nobody where the recording's had woken it.
Both now take an ordered lock first, created once while recording or
replaying with the other record/replay state; when not recording or
replaying the lock id is 0 and taking it does nothing.
The backend's node-recording case worker-threads/atomics-wait-async-
timeout-notify-race mismatched in four replays out of four without this
(the worker's timeout task resolved a promise in the replay that it had
found already notified in the recording) and passed four out of four with
it.
WaitSync decided whether a blocked wait was woken or timed out with events
disallowed, against the clock, so nothing recorded whether the notify or
the timeout came first and a replay could time out a wait the recording's
notify had woken, or wake one the recording had timed out, making the
notify's woken count differ too.
While recording or replaying, a wait that ends woken or timed out now
releases g_mutex and the disallow scope to take the ordered lock Wake
takes, and decides again under it: a notify that takes the lock first wakes
the wait even if its timeout has passed, and one that takes it later finds
the wait gone. The lock is released before the wait callback runs.
The backend's node-recording case worker-threads/atomics-wait-timeout-
notify-race mismatched in four replays out of four without this (the main
thread logged a different result) and passed four out of four with it.
Waiters entered the wait list under g_mutex with events disallowed, so
nothing recorded whether a waiter had entered it by the time a notify ran,
or in which order two waiters on one address entered it: a replay could
have a notify wake the other waiter, or nobody, and with the ordered lock
now taken by the wait's end that left a waiter blocked forever where it
had been woken, hanging the replay instead of mismatching.
While recording or replaying, WaitSync and WaitAsync now hold the ordered
lock from before their value check until the waiter is on the list
(WaitSync releases it with events allowed again, before waiting), and
IsolateDeinit holds it while removing a dying isolate's waiters. What
remains unordered is the program's own stores to the shared memory a wait
compares against, which aren't recorded.
The backend's node-recording case worker-threads/atomics-wait-two-waiters-
notify-one mismatched in four replays out of four without this, also with
the previous two commits, and passed four out of four with it.
Waits that end terminated, or stopped through the embedder's wake handle,
leave the list without taking the ordered lock, which the comments
describing it implied they did.
A wait took the ordered lock once when it found another value or ended
terminated or stopped through the embedder's wake handle, and twice when
it ended woken or timed out. Which value a wait finds isn't recorded, as
the program's stores to the memory aren't, so a replay could take the lock
a different number of times than the recording, and the next thread
waiting for its recorded turn would then wait forever: a hang instead of
a mismatch.
While recording or replaying, every wait now leaves the wait list under
the lock, whatever ended it, and one that found another value takes the
lock a second time too.
AutoOrderedLock moves into v8.h next to OrderedLock, as in the Chromium V8
fork, replacing the copy in the wasm module compiler.
Whether a wait found another value than the one it waits for was read from
the shared memory with events disallowed, and the program's stores to that
memory aren't recorded, so a replay could find another value than the
recording did. Taking the ordered lock the same number of times on every
path only turned one direction of that into a mismatch: a replayed wait
that found the value it waits for where the recording's hadn't blocked,
and the notify that would wake it waited for its recorded turn after the
wait's, hanging the replay.
While recording or replaying, WaitSync and WaitAsync now read the value
under the ordered lock, which every notify takes first, with events
allowed, and record whether it differs; the replay uses the recorded
answer. So a wait finds another value exactly when the recording's did,
and the second take a wait that found another value made is dropped.
Reading it before taking g_mutex left only the ordered lock to keep a notify
from coming between the read and the wait entering the list, and the
ordered lock does nothing while events are passed through or once the
recording has finished (when a process exits with workers still running),
so a wait could miss a notify that upstream can't.
The value is read under g_mutex as upstream does, and only whether it
differs is recorded, with events allowed again for that while g_mutex is
held.
Wake cancelled the timeout task of an async waiter whose buffer and context
had been collected, when it reached the waiter through a new buffer the
allocator had put in the old one's place. Whether that happens depends on
the collector and the allocator, not on anything recorded, and the timeout
task takes the ordered lock when it runs, so a replay could take it a
different number of times than the recording, and the next thread waiting
for its turn would wait forever.
While recording or replaying, such a waiter is left for its timeout task,
which already cleans up a waiter whose context is gone when the cancelling
loses the race with it.
The backend's node-recording case gc/atomics-wait-async-collected-context
mismatched in four replays out of four on the ordered lock without this
(master, without the ordered lock, passed).
Uh oh!
There was an error while loading. Please reload this page.
bhackett1024
pushed a commit
that referenced
this pull request
Nov 5, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189 and #191.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 6, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 6, 2026
Add the v8::recordreplay public API class with methods for recording
state, event control, pointer registration, ordered locks, and the
C API bridge functions and driver symbol loading in api.cc.
Add include/replayio.h with RAII helpers (AutoPassThroughEvents,
AutoDisallowEvents with an optional label, AutoMarkReplayCode) and
include/replayio-macros.h with REPLAY_ASSERT macros usable from C.
Asserts are skipped when the driver disables them, warnings go through
RecordReplayWarning, and progress notifications are ignored while
events are disallowed. When JS progress asserts are enabled, progress
data is handed to the recorder through its assert data callbacks.
The driver can disable individual features at runtime, so
IsRecordingOrReplaying() takes an optional feature name and
FeatureEnabled() asks the driver, with the check skipped entirely when
nothing is disabled.
replayio-macros.h also declares RecordReplayWarningField, the driver's
layout for one typed detail of a warning (a string, integer, double or
bool under a key), and the V8RecordReplayWarning entry point that takes
a warning kind plus an array of those fields.
The scope helpers and the rest of the C++ surface live here too:
AutoAssertMaybeEventsDisallowed, which asserts its message on entry and
exit so the recording orders the scope unless events are disallowed,
AutoOrderedLock, and AreEventsPassedThrough(), each defined next to the
driver symbol it calls.
Rebase note: these headers mirror the driver's ABI. Every driver
function is looked up by name in api.cc, so a new recordreplay::
method needs its symbol loaded there, and RecordReplayWarningField's
layout and the V8RecordReplay* signatures have to match the driver
that REPLAY_BACKEND_REV pins.
Includes later changes from #128, #129, #132, #137, #159, #161, #162,
#170, #173, #190, #191 and #202.
Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 6, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 6, 2026
Add the v8::recordreplay public API class with methods for recording
state, event control, pointer registration, ordered locks, and the
C API bridge functions and driver symbol loading in api.cc.
Add include/replayio.h with RAII helpers (AutoPassThroughEvents,
AutoDisallowEvents with an optional label, AutoMarkReplayCode) and
include/replayio-macros.h with REPLAY_ASSERT macros usable from C.
Asserts are skipped when the driver disables them, warnings go through
RecordReplayWarning, and progress notifications are ignored while
events are disallowed. When JS progress asserts are enabled, progress
data is handed to the recorder through its assert data callbacks.
The driver can disable individual features at runtime, so
IsRecordingOrReplaying() takes an optional feature name and
FeatureEnabled() asks the driver, with the check skipped entirely when
nothing is disabled.
replayio-macros.h also declares RecordReplayWarningField, the driver's
layout for one typed detail of a warning (a string, integer, double or
bool under a key), and the V8RecordReplayWarning entry point that takes
a warning kind plus an array of those fields.
The scope helpers and the rest of the C++ surface live here too:
AutoAssertMaybeEventsDisallowed, which asserts its message on entry and
exit so the recording orders the scope unless events are disallowed,
AutoOrderedLock, and AreEventsPassedThrough(), each defined next to the
driver symbol it calls.
Rebase note: these headers mirror the driver's ABI. Every driver
function is looked up by name in api.cc, so a new recordreplay::
method needs its symbol loaded there, and RecordReplayWarningField's
layout and the V8RecordReplay* signatures have to match the driver
that REPLAY_BACKEND_REV pins.
Includes later changes from #128, #129, #132, #137, #159, #161, #162,
#170, #173, #190, #191 and #202.
Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 6, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
Nov 6, 2026
Add the v8::recordreplay public API class with methods for recording
state, event control, pointer registration, ordered locks, and the
C API bridge functions and driver symbol loading in api.cc.
Add include/replayio.h with RAII helpers (AutoPassThroughEvents,
AutoDisallowEvents with an optional label, AutoMarkReplayCode) and
include/replayio-macros.h with REPLAY_ASSERT macros usable from C.
Asserts are skipped when the driver disables them, warnings go through
RecordReplayWarning, and progress notifications are ignored while
events are disallowed. When JS progress asserts are enabled, progress
data is handed to the recorder through its assert data callbacks.
The driver can disable individual features at runtime, so
IsRecordingOrReplaying() takes an optional feature name and
FeatureEnabled() asks the driver, with the check skipped entirely when
nothing is disabled.
replayio-macros.h also declares RecordReplayWarningField, the driver's
layout for one typed detail of a warning (a string, integer, double or
bool under a key), and the V8RecordReplayWarning entry point that takes
a warning kind plus an array of those fields.
The scope helpers and the rest of the C++ surface live here too:
AutoAssertMaybeEventsDisallowed, which asserts its message on entry and
exit so the recording orders the scope unless events are disallowed,
AutoOrderedLock, and AreEventsPassedThrough(), each defined next to the
driver symbol it calls.
Rebase note: these headers mirror the driver's ABI. Every driver
function is looked up by name in api.cc, so a new recordreplay::
method needs its symbol loaded there, and RecordReplayWarningField's
layout and the V8RecordReplay* signatures have to match the driver
that REPLAY_BACKEND_REV pins.
Includes later changes from #128, #129, #132, #137, #159, #161, #162,
#170, #173, #190, #191 and #202.
Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
pushed a commit
that referenced
this pull request
Nov 6, 2026
Add the v8::recordreplay public API class with methods for recording
state, event control, pointer registration, ordered locks, and the
C API bridge functions and driver symbol loading in api.cc.
Add include/replayio.h with RAII helpers (AutoPassThroughEvents,
AutoDisallowEvents with an optional label, AutoMarkReplayCode) and
include/replayio-macros.h with REPLAY_ASSERT macros usable from C.
Asserts are skipped when the driver disables them, warnings go through
RecordReplayWarning, and progress notifications are ignored while
events are disallowed. When JS progress asserts are enabled, progress
data is handed to the recorder through its assert data callbacks.
The driver can disable individual features at runtime, so
IsRecordingOrReplaying() takes an optional feature name and
FeatureEnabled() asks the driver, with the check skipped entirely when
nothing is disabled.
replayio-macros.h also declares RecordReplayWarningField, the driver's
layout for one typed detail of a warning (a string, integer, double or
bool under a key), and the V8RecordReplayWarning entry point that takes
a warning kind plus an array of those fields.
The scope helpers and the rest of the C++ surface live here too:
AutoAssertMaybeEventsDisallowed, which asserts its message on entry and
exit so the recording orders the scope unless events are disallowed,
AutoOrderedLock, and AreEventsPassedThrough(), each defined next to the
driver symbol it calls.
Rebase note: these headers mirror the driver's ABI. Every driver
function is looked up by name in api.cc, so a new recordreplay::
method needs its symbol loaded there, and RecordReplayWarningField's
layout and the V8RecordReplay* signatures have to match the driver
that REPLAY_BACKEND_REV pins.
Includes later changes from #128, #129, #132, #137, #159, #161, #162,
#170, #173, #190, #191 and #202.
Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 6, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 6, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 6, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 6, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 10, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 11, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 11, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 11, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist
added a commit
that referenced
this pull request
Nov 12, 2026
The futex emulation's own synchronization, the global mutex, the
waiters' condition variables and the wait list, now runs with events
disallowed, so none of it is recorded; the public Wait entry point
asserts on entry and exit instead, which records the order of the
waits. Recorded through its condition variable, a worker blocking in
Atomics.wait while the main thread notified it could not be replayed.
What the replay has to agree on is ordered explicitly: every notify,
every waiter entering or leaving the wait list and the removal of a
dying isolate's waiters take one ordered lock, the same number of times
on every path. A wait records whether it found another value, since the
program's stores to that memory aren't recorded, and one ending woken
or timed out decides again under the lock, so the replay can't time out
a wait the recording's notify woke.
Tasks aren't posted from inside the disallow scopes, which node's
platform asserts on, but queued and posted once the scope and the lock
have ended; each notify posts its own task per isolate, resolving by id
the waiters it notified, so whether it posts doesn't depend on how far
their thread has got. A wait also handles a termination the stack guard
left pending, so a worker blocked in Atomics.wait() can still be
stopped. That termination runs with events allowed: either this thread
requested it before waiting, e.g. a worker's own process.exit(), which
the replay reaches the same way and whose assert has to be recorded, or
another thread did, which already invalidated the recording.
Rebase note: the only things recorded here are the Wait asserts, the
ordered lock rounds and the bit saying whether a wait found another
value. Upstream reworks this file often: re-derive those from the new
control flow, keeping the lock rounds equal on every path and posting
no task while events are disallowed.
From #170, #175, #189, #191 and #226.
Co-authored-by: Brian Hackett <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|