summaryrefslogtreecommitdiff
path: root/runtime/main.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-25 00:47:36 -0300
committerGabriel Schneider <[email protected]>2026-11-25 01:03:16 -0300
commitc26745ef409483d0b101131725a135bb5b3c5e7b (patch)
treeb472f85ecfc49f2efdb1d87c9c31adbd247a9b4a /runtime/main.zig
parentfc45a7c8ed3b279a803dd8daad81329920b0493e (diff)
downloadpardes-c26745ef409483d0b101131725a135bb5b3c5e7b.tar.gz
pardes-c26745ef409483d0b101131725a135bb5b3c5e7b.zip
dump: a byte dump's views not live keep the ranges beside their primaries: loaded, each share's `sels` is the core's, which `views.undumped` gave it (or freed it, a share refused), and the load no longer frees it after: line B's ozlumvqo (the same hunks are A2's ztzvvwkk) freed everything the load made after the core's views were read (`l.shared.items[at..]`), which took each kept share's selection buffer from under the view that holds it; found by the 5-client soak on the walk UI's merged tree M1 (xvnytwqm); RUN FIRST: `zig build replicas -Dplatform=tui -- --clients 5`: `double free or corruption (out)` at seed 0 rtt 30 (glibc, in a client's replica: Replica.confirm, replayUnit, keys.handleKey, normal.textKey, edit.handleInsert, normal.replaySels, Text.setRanges, Text.setRange, Text.dropSels (Text.zig:158), rollback.Epoch.free; the core dump shows the pointer freed inside an 80x21 surface's cell buffer allocated since: a selection buffer freed before and its memory taken again); with the replica cores' allocations on a SafeAllocator over pages (a diagnostic, not kept): `Segmentation fault` reading `pane.body.sels[si]` (body_layer.zig:397, renderBody) in a client's first draw after its join (replicas.zig joined, client.zig draw, views.drawOne, Pardes.render); and dump.zig's new test, a session whose view 0 has a second cursor, dumped (byteDump, a join's) while view 1 is live and loaded: `Segmentation fault` in Text.deinit freeing the parked view's `sels` at the loaded core's deinit (freed already by the load); THE CAUSE: dump.zig:457 (loadKnowing, after `views.undumped(p, others)`) freed every allocation the read of the shares made, the containers (`others`, each `o.panes`) and each share's `pv.body.sels` alike, though `undumped` (views.zig:134) puts each kept share's PaneView, its `sels` slice with it, into `pane.pv[k]`, and frees a refused one's itself: the core's parked views held freed buffers (a draw read them, a view's keys wrote and freed them again); THE FIX: before freeing what it made, the load drops each share's `sels` allocation from that list; the containers are still freed by what the read made, not by hand (ozlumvqo's point: a damaged dump's reference to a slice the core holds is never freed here); a user could hit it: a client joining a session where another client's view (not the one live when the join's dump is made) has more than one cursor: the joining client's core holds that view's freed ranges, and its process aborts or its replica diverges once that view's input is replayed or drawn; TEST: dump.zig 'a byte dump's views not live keep the ranges beside their primaries: loaded, the core holds them, each freed once' (fails before: the segmentation fault above, passes now); the 5-client soak clean (rtt 30/80/207: diverged 0, unequal 0, quiet checks 517/0, 428/0, 611/0, stops off may_wait 0, corpus 22 of 22, no leaks; 710 s); the fuzz at 40,000 join and 1,779 image seeds green in 154 s
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'runtime/main.zig')
0 files changed, 0 insertions, 0 deletions