You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5c0e1cf
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: lib/async/http/protocol/http2/connection.rb
-5Lines changed: 0 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -87,13 +87,8 @@ def start_connection
87
87
end
88
88
89
89
# Close the connection and stop the background reader.
90
-
#
91
-
# If the remote peer sent a graceful GOAWAY frame, the streams it accepted are still being processed and their responses are still on the way. Closing the connection now would fail those requests, even though the remote peer has already processed them. Instead we defer: the background reader closes the connection once the last stream completes. An explicit error still closes the connection immediately.
92
90
defclose(error=nil)
93
91
ifreader=@reader
94
-
# Only the background reader can drain the connection, so if it is not running, there is nothing to wait for:
95
-
returnselfiferror.nil?andself.draining?
96
-
97
92
@reader=nil
98
93
99
94
# The reader task can close the connection itself, e.g. when the last stream completes and the connection is released back to the pool. Stopping it here would cancel the current task in the middle of this method, leaving the underlying stream open, so we let it unwind by itself: `closed?` is now true, so the read loop exits.
Copy file name to clipboardExpand all lines: releases.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Unreleased
4
4
5
-
- HTTP/2 connections which received a graceful `GOAWAY` are no longer closed while the server is still answering the streams it accepted. Such a connection is retired from the pool, but stays open until the last accepted stream completes, so those requests no longer fail with `EOFError: Connection closed with N active stream(s)!`.
5
+
- HTTP/2 connections which received a graceful `GOAWAY` are removed from availability immediately, but remain in the pool until the server has finished answering the streams it accepted. The connection is closed after its final user releases it, so those requests no longer fail with `EOFError: Connection closed with N active stream(s)!`.
it"is not closed while the accepted stream is still in flight"do
180
-
Asyncdo
181
-
connection.read_in_background
182
-
183
-
# The pool retires a connection which is no longer reusable, but the stream the server accepted is still being processed, so the connection must stay open:
184
-
connection.close
185
-
186
-
expect(connection).not.tobe(:closed?)
187
-
expect(connection.streams).not.tobe(:empty?)
188
-
ensure
189
-
connection.close(EOFError.new("Test finished!"))
190
-
end.wait
191
-
end
192
-
193
-
it"is closed if there is no reader to drain it"do
177
+
it"closes synchronously"do
194
178
connection.close
195
179
196
180
expect(connection).tobe(:closed?)
197
181
end
198
182
end
199
183
184
+
it"is retained by the pool until all users release it"do
0 commit comments