summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-22 21:13:14 -0300
committerGabriel Schneider <[email protected]>2026-11-22 22:44:21 -0300
commitf148c600d35cca72c9c2ad2bb03086b9a8587c71 (patch)
tree0cfe8c593255e686f6f668c88178a7d2727a5ed3 /core
parentf8befb15f434edd483c4fcbef034d21165663b82 (diff)
downloadpardes-f148c600d35cca72c9c2ad2bb03086b9a8587c71.tar.gz
pardes-f148c600d35cca72c9c2ad2bb03086b9a8587c71.zip
replica: a client no longer gives up its session while the session says it is upgrading: `redial` (core/replica.zig) counted the session's own refusal `upgrading` (Peers.refuseAll, from telling its clients until its exec, the dump written and fsynced between) as one of its 201 tries of 100 ms, so an Upgrade whose dump took over 20 s let every client go for good, each exiting "could not join again: the session is upgrading to another build of pardes" while its session came back (a release build alike: the bound is the client's); now that word is dialled again without counting, every other failure keeps the 20 s; with an experiment's 24 s sleep after refuseAll (a slow dump) the base failed 1 of 1 with the gate's words (both clients gone, `--ps` listing none, the session back at 24.2 s) and this passed the step 2 of 2 (both back at 24.2 s, with the session); not the cause of the gate's failures as kept (the session back in 0.3 s there): traced on one CPU the window is 33 ms; core-test 917/1074 (157 skipped), shell-test 1116/1119 (3 skipped) (load 3.4-4.1); left: a client of a session stuck inside its Upgrade keeps dialling, a TERM to it waiting as it waited up to 20 s before
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core')
-rw-r--r--core/replica.zig12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/replica.zig b/core/replica.zig
index 71a8de71..01a532b5 100644
--- a/core/replica.zig
+++ b/core/replica.zig
@@ -2936,7 +2936,10 @@ fn sameBuild(gpa: Allocator, j: Joined, why: []u8) ?Joined {
/// The session again, after a divergence or an upgrade: an upgrade's
/// takes the time its exec and load take, and its daemon's, so it is
-/// dialled every 100 ms for 20 s. Null, and why in `why`.
+/// dialled every 100 ms for 20 s. Null, and why in `why`. The session's
+/// own word that it is upgrading (`Peers.refuseAll`, until its exec) is
+/// not a try: it is there, writing its dump for as long as that takes (a
+/// 24 s write let every client go for good, 2026-11-22).
/// `patient`: after an Upgrade's `refused` alone, while the session is
/// away a moment; after a divergence a session that will not answer is
/// gone, and the client says so at once (it froze 20 s, 2026-10-30).
@@ -2944,7 +2947,7 @@ fn sameBuild(gpa: Allocator, j: Joined, why: []u8) ?Joined {
/// none for a first join that met an Upgrade.
fn redial(gpa: Allocator, path: []const u8, session: []const u8, why: *[600]u8, have: ?*Have, patient: bool, view: ?u8) ?Joined {
var tries: u32 = 0;
- while (true) : (tries += 1) {
+ while (true) {
why.* = @splat(0);
if (dial(gpa, path, session, why, have, view)) |j| return sameBuild(gpa, j, why);
// Another build, or another protocol (the daemon moved with its
@@ -2957,7 +2960,10 @@ fn redial(gpa: Allocator, path: []const u8, session: []const u8, why: *[600]u8,
// Its daemon lists no such session: it is gone, not away a moment
// (an Upgrade keeps it listed throughout).
if (std.mem.startsWith(u8, words, "no session called ")) return null;
- if (!patient or tries > 200) return null;
+ if (!std.mem.eql(u8, words, upgrading)) {
+ if (!patient or tries > 200) return null;
+ tries += 1;
+ }
const ts: libc.timespec = .{ .sec = 0, .nsec = 100 * std.time.ns_per_ms };
_ = libc.nanosleep(&ts, null);
}