summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-30 15:19:25 -0300
committerGabriel Schneider <[email protected]>2026-10-30 17:28:17 -0300
commit5938a84d98815818598f5505646edec762089270 (patch)
tree91fea7d8d87c0771bcee8de93c3a912c6a6720e4
parentf2ede98aee0265e3506f5afd6039c70be7812767 (diff)
downloadpardes-5938a84d98815818598f5505646edec762089270.tar.gz
pardes-5938a84d98815818598f5505646edec762089270.zip
docs/next-daemon.md: the remote bugs the user hit, fix's: the session's abort after 15 far joins (c_heap), the window's rejoins at every tag hover and click (a hit resolved on this process's frame), a reflow's overflow of the screen state, a replay's panic at a site it lacked, a rejoin's lost layout, a client's end (its ssh, a gone session redialled 20 s, a dying session's links); each one's test and numbers, here and on the box, and what of the user's symptoms is left
Co-Authored-By: Claude Opus 5.5 <[email protected]>
-rw-r--r--docs/next-daemon.md110
1 files changed, 110 insertions, 0 deletions
diff --git a/docs/next-daemon.md b/docs/next-daemon.md
index 8ec76742..fc66edb1 100644
--- a/docs/next-daemon.md
+++ b/docs/next-daemon.md
@@ -3925,3 +3925,113 @@ Not done, and found on the way:
`SelfInfo.Elf.findModule`, index out of bounds), so a crash record says
that and not the segfault. It is std's, not pardes's (`crash.zig` takes
panics only).
+
+### fix: the session's abort, the window's rejoins, a client's end
+
+The user's window client of the box's session (`pardes-gui
[email protected]:freebsd`, 2026-10-30): the cursor not keeping
+up, the window blinking, panes closing just after they opened, then a
+freeze. The first three were the client joining again, 15 times in its
+25 s; the freeze was the session's abort at about its 16th far join, and
+the client's 20 s of redials after it. An adversarial hunt (a soak harness
+and a variant sweep) found the rest below. Each fix has a test that failed
+before it.
+
+- **The session aborted after 15 far joins (H2).** `c_heap: more distinct
+ allocators than it can name`, from zstd's context on a peer's writer
+ thread. The core's table held 64 copies of one allocator, `ptr` 0 and
+ c_allocator's vtable. `zstd.gpa` is `std.heap.c_allocator`, whose `ptr`
+ is undefined, and nothing outside a test writes it: a release build made
+ it a constant and folded `known.ptr == current.ptr` to false, so every
+ malloc named a new allocator (about four a join) and the 65th panicked. A
+ client's decompressor (one a join) would have aborted after about 30
+ rejoins; the web shell's heap over `wasm_allocator` trapped the same way.
+ - Fix: c_heap reads `current` through a volatile pointer, as its bytes
+ are, so no heap compares a value the compiler may take for anything.
+ - Tests: c_heap's own, which unit-test now runs built ReleaseSafe too (it
+ panicked at the 65th malloc); `test/daemon.py --far` makes 200 far joins
+ of one session, each read whole, and checks its fds, threads and RSS.
+ The installed 0.24 aborted with c_heap's panic within that run. Now,
+ ReleaseSafe: 200 joins in 1.7 s, fds and threads level (8, 8), RSS +112
+ KB; on the box (FreeBSD ReleaseSafe, through ssh): 200 in 185 s, fds 13
+ and threads 11 level, RSS 48964 to 49168 KB.
+- **A window's pointer over a tag diverged it at once (H3, the user's
+ `tape byte 119`), and a click there aborted it (H9).** A step resolved a
+ frontend's pointer hit again on `p.surface`, this process's last frame,
+ which is `.local`: the session never draws a client's view, so the same
+ motion gave the client a tag hit and the session none (`pointer_tag_hit`,
+ `look_hover_wait`). Body hits did the same through `reprojectBodyHit` and
+ a sweep's clamp (the variant hunt's F).
+ - Fix: a hit carries the place it was made on (`Layer.Place`: the layer's
+ viewport, columns, rows and compact rows) and the step resolves it from
+ that, never from a frame; a sweep keeps its body's place to clamp onto.
+ The wire carries the place and a tag hit's line: version 17.
+ - Tests: `--window-clients` sweeps the pointer over the tags and the body
+ and clicks there, at 0 and 207 ms (before: joined again, `tape byte
+ 119`); mouse.zig's two tests from the variant hunt. The hunter's
+ repros: 15 rejoins in 3 s of hovering a tag before, none after; clicks,
+ drags and B3 in a window aborted it before, none after.
+- **A replay that met a site its tape lacked panicked (H9, H12).** Fix: a
+ site or value the replay does not find is a divergence and returns what a
+ speculation gets (`poisonOf`): any later leak costs a rejoin, never the
+ process. Test: tape.zig's.
+- **A view closing left a terminal's resize queued (H10, H6).** `closeView`
+ syncs, which sizes a terminal the closed view sized and queues its
+ `resize_pty`, with no step after it to drain it: a replica's next copy
+ asserted, and a speculation over the queue lost the effect when it rolled
+ back, so the next pump's replay found no `pty_resize` where the tape had
+ one. With the user's config (a font of their own sizes their view) every
+ rejoin diverged at its first keys.
+ - Fix: `closeView` settles in its own unit (fix2's, above, which took
+ the place of a drain here), and so does `leaveView` below; a copy is
+ refused (`error.Queued`), not asserted, over a queue, and the input
+ waits for the authority.
+ - Tests: replica.zig's in-process one (two clients at two sizes, one
+ leaves; the other copies, types and agrees). The user's config with a
+ random mix of keys and pointer: 18 rejoins in a minute before, none in
+ four minutes after.
+- **A reflow overflowed the session's screen state (H7).** A resize to
+ fewer columns puts more rows above the last active top than ever scrolled
+ past it, so `top - history` underflowed where a peer starts afresh; a
+ window client's font made such resizes. Fix: `Rows.update` keeps `top`
+ at or past the history's length (a resize renumbers anyway). Test:
+ screen_state.zig's, 200 long lines narrowed.
+- **A rejoin dropped the client's layout.** Its new view copied the live
+ one, the session's own as it was before the client came. Fix: a session's
+ last client, while nobody else watches the session, leaves it its layout
+ (`leaveView`: columns, focus, scrolls, cursors and size), which a rejoin
+ (an Upgrade's, a divergence's) copies back. Test: views.zig's.
+- **A client's end.** One refused at a redial exited from inside itself and
+ left its ssh and `/tmp/pardes-ssh-<pid>.sock`; one rejoining after a
+ divergence redialled a gone session for 20 s; a session that panicked
+ kept its clients' links open for the seconds its trace took.
+ - Fixes: the ssh is ended at `atexit` and dies with its client
+ (PDEATHSIG); a redial waits only after an Upgrade's `refused` and else
+ says "could not join again"; the panic and segfault handlers shut every
+ client's link first.
+ - Tests: `--far` attaches through an ssh stand-in, refused and detached,
+ and finds both gone; `test/daemon.py` kills a session under a replica
+ client, which ends within 2 s, in words; replica.zig's redial test.
+- **A far join's leave held the session's step** while the writer hashed
+ the rest of its blobs (the hunter's review, unconfirmed). Fix: the writer
+ stops at the next blob once it is let go. ponytail: one blob's hash (about
+ 30 ms for 100 MB) is the ceiling.
+- **Kept as diagnostics:** the trace's unit descriptions give a key's and a
+ pointer's words, and a confirmed speculation's state is checked against
+ its unit's digest, which names the input that diverged rather than a later
+ unit replayed.
+- **The user's symptoms, rechecked** on the box (ReleaseSafe at both ends, a
+ window here with the user's own config through ssh, a monkey of keys,
+ pointer, wheel, clicks and shell commands, 2 minutes), on this line over
+ fix2's and fix3's:
+ - Rejoins: none in 760 actions, 20 checks all agreed. (Before fix2's
+ line, one in 799, at a `.kind` site its tape lacked, which had aborted
+ the client.) Panes no longer close: a rejoin keeps the layout anyway.
+ - The freeze: the session no longer aborts, and a client of one that does
+ ends at once, saying so.
+ - The blinking and the cursor: 4 visible rollbacks in the 2 minutes (4
+ inputs of 2375 mispredicted; 45 and 32 of 2369 before fix2's line).
+ Each is a clock guess: an edit's file time a second off across a
+ second's turn, or the millisecond clock the steps of Ctrl-W, Ctrl-O and
+ Ctrl-U read. Not fixed: a guess of the session's clock is the design's
+ ceiling there; reading a coarser clock in those steps is the next step.