From aba74067f316bf59e2c578f6b7a644deb824b3be Mon Sep 17 00:00:00 2001 From: ozpool Date: Mon, 11 May 2026 11:52:03 +0530 Subject: [PATCH] rpc: accept Windows reset error in websocket read limit test TestServerWebsocketReadLimit/limit_with_large_request_-_should_fail flakes on windows/amd64 when the server-side close races the client read. On Windows the OS surfaces the reset as read tcp ...->...: wsarecv: An existing connection was forcibly closed by the remote host instead of a websocket close frame, and the test rejects this as "unexpected error for read limit violation". Treat error strings containing "forcibly closed" as another acceptable outcome of exceeding the read limit, alongside the existing CloseError 1009, ErrReadLimit, and "connection reset by peer" matches. Fixes #34877 --- rpc/server_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rpc/server_test.go b/rpc/server_test.go index 8334d4e80d..5322a6094f 100644 --- a/rpc/server_test.go +++ b/rpc/server_test.go @@ -274,8 +274,11 @@ func TestServerWebsocketReadLimit(t *testing.T) { } else if !errors.Is(err, websocket.ErrReadLimit) && !strings.Contains(strings.ToLower(err.Error()), "1009") && !strings.Contains(strings.ToLower(err.Error()), "message too big") && - !strings.Contains(strings.ToLower(err.Error()), "connection reset by peer") { - // Not the error we expect from exceeding the message size limit. + !strings.Contains(strings.ToLower(err.Error()), "connection reset by peer") && + !strings.Contains(strings.ToLower(err.Error()), "forcibly closed") { + // On Windows the server-side close races the client read and the OS + // surfaces the reset as "wsarecv: An existing connection was forcibly + // closed by the remote host" instead of a websocket close frame. t.Fatalf("unexpected error for read limit violation: %v", err) } } else {