atproto relay implementation in zig zlay.waow.tech
9
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: add read timeout to metrics server to prevent connection stalls

the single-threaded metrics server on :3001 blocks on accept/read with
no timeout. if any client connects but doesn't complete the request
(e.g. during startup storm), the thread blocks forever and all
subsequent scrapes fail. sets SO_RCVTIMEO=5s on accepted connections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

zzstoatzz 27d71026 2a561658

+3
+3
src/main.zig
··· 59 59 log.debug("metrics accept error: {s}", .{@errorName(err)}); 60 60 continue; 61 61 }; 62 + // 5s read timeout — prevents stale connections from blocking the single-threaded server 63 + const timeout = std.posix.timeval{ .sec = 5, .usec = 0 }; 64 + std.posix.setsockopt(conn.stream.handle, std.posix.SOL.SOCKET, std.posix.SO.RCVTIMEO, std.mem.asBytes(&timeout)) catch {}; 62 65 handleMetricsConn(conn.stream, self.stats, self.validator, self.data_dir, self.persist, self.bc); 63 66 } 64 67 }