From 75300d4a271423dabf52770f2362ea70cf7c00f0 Mon Sep 17 00:00:00 2001 From: Mauricio Fabian Prieto Davila Date: Sat, 5 Dec 2026 11:01:52 -0600 Subject: [PATCH] Tests: the SSO-only test fails on Node 26 (socket hang up) because its client reuses a socket the gate just destroyed When the remote gate closes it destroys every remote socket, keep-alive sockets included. On Node 26 the test's keep-alive client hands one of those sockets to the next request before it has read the reset, so the request after the gate closes fails with ECONNRESET ('socket hang up') instead of the expected status. The gate's behavior is the intended one; the test now opens a fresh connection per request. --- test/sso-only.test.mjs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/sso-only.test.mjs b/test/sso-only.test.mjs index 0c25e9ac..779d0f8a 100644 --- a/test/sso-only.test.mjs +++ b/test/sso-only.test.mjs @@ -52,7 +52,11 @@ async function stack({config = () => V2()} = {}) { await new Promise((r) => remote.listen(0, '127.0.0.1', r)) const req = (port, {method = 'GET', path = '/', headers = {}, body} = {}) => new Promise((resolve, reject) => { - const r = http.request({host: '127.0.0.1', port, method, path, headers: {host: HOST, ...headers, ...(body ? {'content-type': 'application/json', 'content-length': Buffer.byteLength(body)} : {})}}, (res) => { + // A fresh connection per request. When the gate closes it destroys every remote socket, + // keep-alive sockets included (server/app.mjs). On Node 26 the client's keep-alive agent can + // hand one of those sockets to the next request before it has read the reset, and that request + // fails with ECONNRESET ("socket hang up"). Node 22 and 24 open a new connection there instead. + const r = http.request({host: '127.0.0.1', port, agent: false, method, path, headers: {host: HOST, ...headers, ...(body ? {'content-type': 'application/json', 'content-length': Buffer.byteLength(body)} : {})}}, (res) => { let text = '' res.on('data', (c) => (text += c)) res.on('end', () => resolve({status: res.statusCode, headers: res.headers, text}))