Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ unreleased

### Fixed

- A pooled HTTP/2 connection no longer closes when the caller that opened it
exits. It stayed owned by that caller, so its exit failed every other
caller's request on the connection with `{error, closed}`. A shared
connection now has no owner: each stream is tied to its own caller and is
reset if that caller dies, and the connection closes itself once it has had
no open stream for the pool `timeout` (#937, thanks @smartinio).
- Unregistering a pooled HTTP/2 connection no longer leaks its per-host slot.
The pool dropped its monitor on the connection, so the slot was never
released when the connection stopped.
- A request that races a peer-initiated close now returns `{error, closed}`
instead of `{error, invalid_state}`. A connection that sees the peer close
stays alive briefly so late calls get an answer, and during that window every
Expand Down
4 changes: 3 additions & 1 deletion src/hackney.erl
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,9 @@ connect_pool_ssl(Transport, Host, Port, Options, FinalSslOpts, PoolHandler) ->
maybe_register_h2(ConnPid, Host, Port, Transport, Options, PoolHandler) ->
try hackney_conn:get_protocol(ConnPid) of
http2 ->
%% HTTP/2 negotiated - register for connection sharing
%% HTTP/2 negotiated - register for connection sharing. Share it first
%% so it no longer dies with this caller while other callers use it.
_ = hackney_conn:share_h2(ConnPid),
PoolHandler:register_h2(Host, Port, Transport, ConnPid, Options);
http1 ->
ok;
Expand Down
Loading
Loading