Repository navigation
Conversation
A pooled http+unix request failed with {error, nxdomain}:
connect_pool_new/6 checked every non-SSL request out of the pool as
hackney_tcp, so the pool dialled the socket path as a TCP host name.
Only HTTPS needs a TCP checkout, because the pool stores plain
connections and upgrades them in place. Other transports are now
checked out as themselves.
Two more places assumed every plain connection is TCP:
- connection_key/4 lowercased the host, and the pool dials the host
stored in the key, so a socket path with upper-case letters was not
found. Unix socket paths now keep their case.
- Closing a connection at checkin prewarmed the host over TCP. Prewarm
now dials the transport the closed connection used.
ashtonian
marked this pull request as ready for review
November 4, 2026 06:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Pooled
http+unix://requests now work. Before this change, every pooled request over a unix domain socket failed with{error, nxdomain}. Only{pool, false}worked.Why
connect_pool_new/6checks out every non-SSL request ashackney_tcp, so the pool dials the socket path as a TCP host name. Only HTTPS needs a TCP checkout, because the pool stores plain connections and upgrades them in place. Other transports are now checked out as themselves.Two related places also assumed TCP:
connection_key/4lowercases the host, and the pool dials the host stored in the key, so/run/App.sockwas dialled as/run/app.sock. Unix socket paths now keep their case.How to test
rebar3 eunit --module=hackney_pool_unix_socket_testsruns cowboy on a unix socket with a mixed-case path. It checks that pooled requests reuse one connection, and that closing an overflow connection prewarms over the socket. Reverting any one of the three changes makes at least one of the tests fail.rebar3 xref,rebar3 eunit(1232 tests) andrebar3 dialyzerpass on OTP 27.3.The tests send
Host: localhost. The defaultHostfor anhttp+unixURL is the percent-encoded socket path (#383), which released cowlib versions reject with a 400. Cowlibmasteraccepts it since ninenines/cowlib@774a7bf (ninenines/cowlib#53), but that isn't in a release yet.