From 2a1338ca5b6b21b279e7b620be99fb36e1c0aa01 Mon Sep 17 00:00:00 2001 From: HoneyryderChuck Date: Sun, 12 Jan 2025 00:16:31 +0000 Subject: [PATCH] fix: handle multi goaway frames coming from server nodejs servers, for example, seem to send them when shutting down servers on timeout; when receiving, in the same buffer, the first correctly closes the parser and emits the message, while the second, because the parser is closed already, will emit an exception; the regression happened because the second exception was swallowed by the pool handler, but now that's gone, and errors on connection consumption get handled; this was worked around by, on the parser, when emitting the errors for pending requests, claearing the queue, as when the second error comes, there's no request to emit the error for Closes #333 --- lib/httpx/connection/http2.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/httpx/connection/http2.rb b/lib/httpx/connection/http2.rb index fcac86b9..8f09abf0 100644 --- a/lib/httpx/connection/http2.rb +++ b/lib/httpx/connection/http2.rb @@ -137,7 +137,7 @@ module HTTPX emit(:error, req, ex) end - @pending.each do |req| + while (req = @pending.shift) next if request && request == req emit(:error, req, ex)