From d4d222a517c8679b36a9dcd4812b6feba8ebc1ab Mon Sep 17 00:00:00 2001 From: flowerinthenight Date: Tue, 24 Sep 2024 04:44:14 +0900 Subject: [PATCH] lib: ci skip: disable removal of faulty members for now --- Dockerfile | 2 +- src/scratch.zig | 8 ++++++++ src/zgroup.zig | 8 +++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index a865a6b..7c55a6b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ COPY src/ ./src/ COPY build* ./ RUN curl -O https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz && \ xz --decompress zig-linux-x86_64-0.13.0.tar.xz && tar -xf zig-linux-x86_64-0.13.0.tar && \ -./zig-linux-x86_64-0.13.0/zig build -Doptimize=ReleaseSafe --summary all +./zig-linux-x86_64-0.13.0/zig build -Doptimize=ReleaseFast --summary all FROM debian:stable-slim RUN set -x && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y curl ca-certificates && rm -rf /var/lib/apt/lists/* diff --git a/src/scratch.zig b/src/scratch.zig index c01fd79..b4fb21b 100644 --- a/src/scratch.zig +++ b/src/scratch.zig @@ -170,3 +170,11 @@ test "returnblock" { dbg("should not be here\n", .{}); } + +test "accesslen" { + const i: usize = 1; + const buf = try std.fmt.allocPrint(std.testing.allocator, "hello world {d}", .{i}); + dbg("len={d}\n", .{buf.len}); + std.testing.allocator.free(buf); + dbg("len={d}\n", .{buf.len}); +} diff --git a/src/zgroup.zig b/src/zgroup.zig index 8d997ff..8467d16 100644 --- a/src/zgroup.zig +++ b/src/zgroup.zig @@ -591,8 +591,6 @@ pub fn Fleet(UserData: type) type { counts[3], }); - try self.removeFaultyMembers(); - var key_ptr: ?[]const u8 = null; const pt = try self.getPingTarget(arena); if (pt) |v| key_ptr = v; // ensure non-null @@ -709,6 +707,11 @@ pub fn Fleet(UserData: type) type { try self.callbacks.onLeader.?(self.allocator, self.callbacks.data, me); } + // TODO: At the moment, this causes intermittent crashes due to keys + // becoming freed. Needs more investigation. For now, we're not + // removing any keys; just keep them all with .faulty state. + // try self.removeFaultyMembers(); + // Pause before the next tick. const elapsed = tm.read(); if (elapsed < self.protocol_time) { @@ -1105,7 +1108,6 @@ pub fn Fleet(UserData: type) type { // Handle the isd_* faulty protocol of the message payload. // We are passing in an arena allocator here. fn handleConfirmFaulty(self: *Self, allocator: std.mem.Allocator, msg: *Message) !void { - log.debug(">>>>> listen: confirm faulty", .{}); const key = try keyFromIpPort(allocator, msg.isd_ip, msg.isd_port); if (!self.keyIsMe(key)) { try self.setMemberInfo(key, .faulty, null, true);