summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/replica.zig16
1 files changed, 10 insertions, 6 deletions
diff --git a/core/replica.zig b/core/replica.zig
index 01a532b5..a2dd8e15 100644
--- a/core/replica.zig
+++ b/core/replica.zig
@@ -2828,7 +2828,7 @@ pub fn join(gpa: Allocator, j: *Joined, path: []const u8, session: []const u8, o
sameBuild(gpa, (dial(gpa, path, session, why, have, null) orelse
// Handed to the session as it upgraded, or cut by its exec with
// its dump on the way: it is there again soon.
- if (std.mem.eql(u8, std.mem.sliceTo(why, 0), upgrading) or cutListed(why, session, have != null)) redial(gpa, path, session, why, have, true, null) else null) orelse return null, why)) orelse return null;
+ if (std.mem.eql(u8, std.mem.sliceTo(why, 0), upgrading) or cutListed(why, session, have != null)) redial(gpa, path, session, why, have, true, null) else null) orelse return null, why, false)) orelse return null;
defer {
if (have) |h| h.store(gpa, j) else gpa.free(j.dump);
j.dump = &.{};
@@ -2905,7 +2905,7 @@ fn ownBoot(gpa: Allocator, j: *Joined, fd: c_int, o: pardes.Options, why: *[600]
pub fn confirmBoot(gpa: Allocator, j: *Joined, r: *Replica, o: pardes.Options, why: *[600]u8) ?*Replica {
const t0 = nowNs();
const digest = j.digest;
- j.* = sameBuild(gpa, joinOn(gpa, j.fd, null, why, null, null, digest) orelse return null, why) orelse return null;
+ j.* = sameBuild(gpa, joinOn(gpa, j.fd, null, why, null, null, digest) orelse return null, why, false) orelse return null;
if (j.dump.len == 0) {
r.id = j.client;
r.view = j.view;
@@ -2922,10 +2922,14 @@ pub fn confirmBoot(gpa: Allocator, j: *Joined, r: *Replica, o: pardes.Options, w
/// `j`, when its session runs this build; else its link let go, and why in
/// `why`: the daemon judged the hello by what the session last said, which
-/// an upgrade under way may not have said yet.
-fn sameBuild(gpa: Allocator, j: Joined, why: []u8) ?Joined {
+/// an upgrade under way may not have said yet. `again`: it was a rejoin for
+/// the view the session kept, which the welcome gave it: kept again for it
+/// (its bye's `again`), for the build at its start path, exec'd, to come
+/// back to (client.zig `execAgain`); closed, it came back in a new view,
+/// its own lost (1 in 4 Upgrades on one CPU, 2026-11-22).
+fn sameBuild(gpa: Allocator, j: Joined, why: []u8, again: bool) ?Joined {
if (j.semantics == wire.semantics) return j;
- bye(j.fd, .{});
+ bye(j.fd, .{ .again = again });
_ = libc.close(j.fd);
var jj = j;
jj.rest.deinit(gpa);
@@ -2949,7 +2953,7 @@ fn redial(gpa: Allocator, path: []const u8, session: []const u8, why: *[600]u8,
var tries: u32 = 0;
while (true) {
why.* = @splat(0);
- if (dial(gpa, path, session, why, have, view)) |j| return sameBuild(gpa, j, why);
+ if (dial(gpa, path, session, why, have, view)) |j| return sameBuild(gpa, j, why, view != null);
// Another build, or another protocol (the daemon moved with its
// session): no dial again will do.
const words = std.mem.sliceTo(why, 0);