Skip to content

Commit 5478d5a

Browse files
ryansolidClaude via Cursorcursoragent
committed
fix(signals): a landing re-judges the transactions parked at its seam (fuzzer F3)
A reader mounted while a flight is up is born held (A29 ruling A); unmounting it in the same hold stages its removal, making it a zombie that observes another flight, and that observation blocks an unrelated write (`src=0`) in a newer transaction (A15 #3463: a zombie is live for every hold "until the commit that disposes it"). The seam judges transactions newest first: the `src=0` transaction is judged blocked, then the older hold lands (its mount control nets to committed) and its commits dispose the zombie — but nothing judges `src=0` again. The `schedule()` in `disposeChildren` cannot cover this: `land` has already nulled the zombie's `_x._transaction`, and even ungated, a `schedule()` inside `settle` is overwritten by `flush`'s own `scheduled` recompute. `settle` now restarts its landing loop after every landing, so the transactions it parked are judged against the world the landing committed. The zombie is disposed, holds nothing, and `src=0` lands at the same seam. Deviation from the hand-off brief's triage: the brief named the `disposeChildren` predicate (zombie's transaction nulled before the disposing commit) as the cause and offered "schedule() for any dying pending node" or "iterate settle to a fixpoint". The predicate is false as triaged, but dropping it does not fix F3 (the scheduled seam is lost inside `settle`); the fixpoint is the fix. +11 B minified (core floor). F3 flips from `it.fails` to `it`. No other pin moved. Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]>
1 parent 74452b1 commit 5478d5a

3 files changed

Lines changed: 79 additions & 71 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/signals": patch
3+
---
4+
5+
A landing whose commits dispose a zombie re-judges the transactions parked at the same seam: a write held only because that zombie observed its flight now lands with the commit that disposes it instead of staying unpublished until an unrelated flush (fuzzer F3).

‎packages/signals/src/core/scheduler.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,10 @@ export class GlobalQueue implements IQueue {
834834
transactions.splice(k, 1);
835835
GlobalQueue._endLanes?.(u);
836836
land(u);
837+
// A landing's commits can dispose a zombie a transaction judged above
838+
// was blocked on (#3463: live "until the commit that disposes it") —
839+
// judge them again.
840+
k = transactions.length;
837841
}
838842
// The store folds the pending backings whose container nodes committed
839843
// — this flush's, or a landing's (store/store.ts installs it).

‎packages/signals/tests/fuzz-findings-l2.test.ts‎

Lines changed: 70 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -196,78 +196,77 @@ describe("fuzz findings on L2 — holds and boundaries", () => {
196196
// is "live for every hold until the commit that disposes it". A reader
197197
// mounted while a flight is up is born held (its mount control stays
198198
// unpublished); unmounting it in the same hold stages its removal; that
199-
// hold lands (mount nets to committed) — and the reader survives it as a
200-
// zombie no longer owned by any transaction, keeping an unrelated write
201-
// (`src=0`, held only because the zombie observes its flight) unpublished
202-
// although nothing on screen waits on anything (fuzzer P1).
203-
it.fails(
204-
"F3: a born-held reader dies with the commit that withdraws its mount, releasing an unrelated write (A29 ruling A, A15 #3463)",
205-
async () => {
206-
const gates = new Map<string, () => void>();
207-
const [src, setSrc] = createSignal(0);
208-
const [mounted, setMounted] = createSignal(false);
209-
let shownSrc = -1,
210-
shownMounted: boolean | undefined,
211-
panel: unknown = "absent";
212-
let dispose!: () => void;
213-
createRoot(d => {
214-
dispose = d;
215-
const a = createMemo(() => gated(gates, `a:${src()}`, src()));
216-
const b = createMemo(() => {
217-
const v = a();
218-
return gated(gates, `b:${v}`, v);
219-
});
220-
createRenderEffect(src, v => {
221-
shownSrc = v;
222-
});
223-
createRenderEffect(mounted, v => {
224-
shownMounted = v;
225-
});
226-
createRenderEffect(
227-
() =>
228-
mounted()
229-
? createRoot(d2 => {
230-
createRenderEffect(b, v => {
231-
panel = v;
232-
});
233-
onCleanup(() => {
234-
panel = "absent";
235-
});
236-
return d2;
237-
})
238-
: undefined,
239-
d2 => {
240-
if (d2) onCleanup(d2);
241-
}
242-
);
199+
// hold lands (mount nets to committed) and its commits dispose the zombie.
200+
// The seam judged the newer transaction (`src=0`, held only because the
201+
// zombie observes its flight) first, blocked, and never again: a
202+
// `schedule()` from the disposal inside the landing is overwritten by the
203+
// flush's own `scheduled` recompute. The seam now re-judges the parked
204+
// transactions after every landing (fuzzer P1).
205+
it("F3: a write held only by a zombie lands with the commit that disposes it (A29 ruling A, A15 #3463)", async () => {
206+
const gates = new Map<string, () => void>();
207+
const [src, setSrc] = createSignal(0);
208+
const [mounted, setMounted] = createSignal(false);
209+
let shownSrc = -1,
210+
shownMounted: boolean | undefined,
211+
panel: unknown = "absent";
212+
let dispose!: () => void;
213+
createRoot(d => {
214+
dispose = d;
215+
const a = createMemo(() => gated(gates, `a:${src()}`, src()));
216+
const b = createMemo(() => {
217+
const v = a();
218+
return gated(gates, `b:${v}`, v);
243219
});
244-
flush();
245-
gates.get("a:0")!();
246-
await drain();
247-
gates.get("b:0")!();
248-
await drain();
249-
expect([shownSrc, shownMounted, panel]).toEqual([0, false, "absent"]);
250-
setSrc(1); // a:1 flies unobserved → commits
251-
await drain();
252-
expect(shownSrc).toBe(1);
253-
gates.get("a:1")!(); // b:1 starts, unobserved
254-
await drain();
255-
setMounted(true); // the reader is born held on b:1; the mount is held with it
256-
await drain();
257-
expect([shownMounted, panel]).toEqual([false, "absent"]);
258-
setSrc(0); // a:0 — held while the (unshown) reader waits
259-
await drain();
260-
expect(shownSrc).toBe(1);
261-
setMounted(false); // the mount request is withdrawn: nets to committed, lands
262-
await drain();
263-
expect([shownMounted, panel]).toEqual([false, "absent"]);
264-
// Nothing visible observes any flight: the write publishes.
265-
expect(shownSrc).toBe(0);
266-
dispose();
267-
for (const g of gates.values()) g();
268-
await drain();
269-
}
270-
);
220+
createRenderEffect(src, v => {
221+
shownSrc = v;
222+
});
223+
createRenderEffect(mounted, v => {
224+
shownMounted = v;
225+
});
226+
createRenderEffect(
227+
() =>
228+
mounted()
229+
? createRoot(d2 => {
230+
createRenderEffect(b, v => {
231+
panel = v;
232+
});
233+
onCleanup(() => {
234+
panel = "absent";
235+
});
236+
return d2;
237+
})
238+
: undefined,
239+
d2 => {
240+
if (d2) onCleanup(d2);
241+
}
242+
);
243+
});
244+
flush();
245+
gates.get("a:0")!();
246+
await drain();
247+
gates.get("b:0")!();
248+
await drain();
249+
expect([shownSrc, shownMounted, panel]).toEqual([0, false, "absent"]);
250+
setSrc(1); // a:1 flies unobserved → commits
251+
await drain();
252+
expect(shownSrc).toBe(1);
253+
gates.get("a:1")!(); // b:1 starts, unobserved
254+
await drain();
255+
setMounted(true); // the reader is born held on b:1; the mount is held with it
256+
await drain();
257+
expect([shownMounted, panel]).toEqual([false, "absent"]);
258+
setSrc(0); // a:0 — held while the (unshown) reader waits
259+
await drain();
260+
expect(shownSrc).toBe(1);
261+
setMounted(false); // the mount request is withdrawn: nets to committed, lands
262+
await drain();
263+
expect([shownMounted, panel]).toEqual([false, "absent"]);
264+
// Nothing visible observes any flight: the write publishes.
265+
expect(shownSrc).toBe(0);
266+
dispose();
267+
for (const g of gates.values()) g();
268+
await drain();
269+
});
271270

272271
// F4. A15: "writes whose async work is observed by a shared reader settle
273272
// as one unit (no tearing — nothing commits until all entangled async

0 commit comments

Comments
 (0)