Skip to content

Revert to hackney ~> 1.16: 4.x cannot use unix sockets - #4

Merged
janwillemvd merged 1 commit into
masterfrom
janwillemvd/hold-hackney-1x
Aug 9, 2026
Merged

janwillemvd merged 1 commit into
masterfrom
janwillemvd/hold-hackney-1x

Conversation

@janwillemvd

Copy link
Copy Markdown

Reverts #3 and documents why the cap has to stay.

#3 widened the requirement to allow hackney 4.x, reasoning that excontainers only reaches hackney through Tesla.Adapter.Hackney and makes no direct :hackney.* calls. True, but it missed that we reach the Docker daemon over a unix domain socket (http+unix://%2Fvar%2Frun%2Fdocker.sock, see Docker.Api.HackneyHost) — and hackney 4.x can no longer connect to one.

4.7.2 still parses the URL correctly (transport: hackney_local_tcp, host: ~c"/var/run/docker.sock", port: 0) and ships a byte-identical hackney_local_tcp.erl, but its rewritten connection layer sends the request through hackney_happy (happy-eyeballs DNS) and never dispatches the local_tcp transport:

hackney :hackney.request(:get, "http+unix://%2Fvar%2Frun%2Fdocker.sock/v1.41/version", [], "", [])
1.25.0 {:error, :enoent} — tried the socket
4.7.2 {:error, :nxdomain} — tried DNS

Downstream this made Excontainers.Container.init/1 fail and took out every test using a container — qdentity/mindfields-phx#4587 went from master's 147 passed to 135 passed + 12 invalid and was dequeued by the merge queue.

Swapping adapters isn't an escape either: hackney is the only Tesla adapter with unix-socket support.

The constraint now carries a comment explaining all of this, so it doesn't get widened again. Revisit once upstream restores unix-socket support.

#3 widened this to allow hackney 4.x on the reasoning that we only reach
hackney through Tesla.Adapter.Hackney and make no direct :hackney calls. That
missed that we reach the Docker daemon over a unix domain socket, which
hackney 4.x can no longer connect to.

The URL still parses correctly in 4.7.2 (transport hackney_local_tcp, host
/var/run/docker.sock, port 0) and hackney_local_tcp.erl is byte-identical to
1.25.0, but 4.x's rewritten connection layer routes through hackney_happy
(happy-eyeballs DNS) and never dispatches the local_tcp transport:

  :hackney.request(:get, "http+unix://%2Fvar%2Frun%2Fdocker.sock/v1.41/version", [], "", [])
  1.25.0 => {:error, :enoent}    (tried the socket)
  4.7.2  => {:error, :nxdomain}  (tried DNS)

Downstream this made Excontainers.Container.init/1 fail and took out every
test using a container (qdentity/mindfields-phx#4587 was dequeued over it).

Restores the cap and documents why, so it isn't widened again.
@janwillemvd janwillemvd self-assigned this Aug 9, 2026
@greptile-apps

greptile-apps Bot commented Aug 9, 2026

Copy link
Copy Markdown

Required label not found on this PR.

@janwillemvd
janwillemvd merged commit 05f8f57 into master Aug 9, 2026
1 of 2 checks passed
@janwillemvd
janwillemvd deleted the janwillemvd/hold-hackney-1x branch August 9, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant