Downgrade Hackney #7860

Merged
feld merged 1 commit from hackney-downgrade into develop 2026-04-08 19:29:51 +00:00
Owner

It appears the implementation of Happy Eyeballs in 1.22.0 is the origin of
some pretty serious performance regressions that remain even in the latest
Hackney 3.0 branch.

Connection tests:

=== 1.22.0 ===
First call: 9434ms
Second call: 14ms

=== 1.21.0 ===
First call: 228ms
Second call: 16ms

Checklist

  • Adding a changelog: In the changelog.d directory, create a file named <code>.<type>.
It appears the implementation of Happy Eyeballs in 1.22.0 is the origin of some pretty serious performance regressions that remain even in the latest Hackney 3.0 branch. Connection tests: === 1.22.0 === First call: 9434ms Second call: 14ms === 1.21.0 === First call: 228ms Second call: 16ms ### Checklist - [ ] Adding a changelog: In the `changelog.d` directory, create a file named `<code>.<type>`. <!-- `<code>` can be anything, but we recommend using a more or less unique identifier to avoid collisions, such as the branch name. `<type>` can be `add`, `change`, `remove`, `fix`, `security` or `skip`. `skip` is only used if there is no user-visible change in the PR (for example, only editing comments in the code). Otherwise, choose a type that corresponds to your change. In the file, write the changelog entry. For example, if a PR adds group functionality, we can create a file named `group.add` and write `Add group functionality` in it. If one changelog entry is not enough, you may add more. But that might mean you can split it into two PRs. Only use more than one changelog entry if you really need to (for example, when one change in the code fix two different bugs, or when refactoring). -->
Downgrade Hackney to 1.21.0 before connection performance regressions
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending
d86a43afef
It appears the implementation of Happy Eyeballs in 1.22.0 is the origin of
some pretty serious performance regressions that remain even in the latest
Hackney 3.0 branch.

Connection tests:

=== 1.22.0 ===
First call:  9434ms
Second call: 14ms

=== 1.21.0 ===
First call:  228ms
Second call: 16ms
feld force-pushed hackney-downgrade from d86a43afef
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending
to 60b03191f0
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
2026-03-24 18:56:48 +00:00
Compare
Author
Owner

from my testing with a simple mix task that profiles Webfinger lookups

image

from my testing with a simple mix task that profiles Webfinger lookups ![image](/attachments/5c3be2c5-dbd6-4a8c-ade2-a5f7b52c2e9d)
Owner

Summary about various recent Hackney-related issues so info isn't scattered throughout multiple issues and fedi threads:

  • There is a regression in Hackney somewhere between 1.22.0 and 1.25.0 (version used by Pleroma as of 6bbfba7f6e) that causes faulty {:error, :checkout_timeout} errors when processing outgoing federation jobs, or fetching/refreshing Actors. (#7834)
    • Hackney 1.21.0 produced few {:error, :checkout_timeout} errors when used as client for MediaProxy; it is currently unclear if that is caused by a regression in that version of Hackney, or due to high server load.
  • There seems to be regression in Hackney 1.25.0 that causes Swoosh to fail sending email via Mailgun due to "incompatible ssl options" being specified possibly by Swoosh itself (#7855); Pleroma is also possibly affected by this issue when an instance admin specified custom ssl_options in the configuration file or ConfigDB. (#7824)
    • The latter could not be reproduced on a local development instance.
    • What version is unaffected is unknown, but based on Hackney changelog the first affected version might be 1.21.0.
  • Newer versions than 1.25.0 cannot be used because they all require OTP27+ and possibly changed connection pooling in an incompatible way to how Pleroma uses it.

Due to the above, 1.20.1 might be a better version to downgrade to since it possibly does not have the ssl_options regression, although I have no way to confirm that since I could not reproduce the issue and I don't have a Mailgun account to test with.

Summary about various recent Hackney-related issues so info isn't scattered throughout multiple issues and fedi threads: * There is a regression in Hackney somewhere between 1.22.0 and 1.25.0 (version used by Pleroma as of 6bbfba7f6e) that causes faulty `{:error, :checkout_timeout}` errors when processing outgoing federation jobs, or fetching/refreshing Actors. (#7834) * Hackney 1.21.0 produced few `{:error, :checkout_timeout}` errors when used as client for MediaProxy; it is currently unclear if that is caused by a regression in that version of Hackney, or due to high server load. * There seems to be regression in Hackney 1.25.0 that causes Swoosh to fail sending email via Mailgun due to "incompatible ssl options" being specified possibly by Swoosh itself (#7855); Pleroma is also possibly affected by this issue when an instance admin specified custom `ssl_options` in the configuration file or ConfigDB. (#7824) * The latter could not be reproduced on a local development instance. * What version is unaffected is unknown, but based on Hackney changelog the first affected version might be [1.21.0](https://hexdocs.pm/hackney/news.html#1-21-0-2025-02-20). * Newer versions than 1.25.0 cannot be used because they all require OTP27+ and possibly changed connection pooling in an incompatible way to how Pleroma uses it. Due to the above, 1.20.1 might be a better version to downgrade to since it possibly does not have the `ssl_options` regression, although I have no way to confirm that since I could not reproduce the issue and I don't have a Mailgun account to test with.
Owner

Also when I thought about this more. The long wait could be possibly related to the default connect_timeout in Hackney being way too long (8 seconds). Try lowering that and see if the times change and check if the host you are connecting to actually has working IPv6 besides AAAA records.

https://hexdocs.pm/hackney/1.25.0/hackney.html#request/5

Also when I thought about this more. The long wait could be possibly related to the default `connect_timeout` in Hackney being way too long (8 seconds). Try lowering that and see if the times change and check if the host you are connecting to actually has working IPv6 besides AAAA records. https://hexdocs.pm/hackney/1.25.0/hackney.html#request/5
Author
Owner

@phnt wrote in #7860 (comment):

Also when I thought about this more. The long wait could be possibly related to the default connect_timeout in Hackney being way too long (8 seconds). Try lowering that and see if the times change and check if the host you are connecting to actually has working IPv6 besides AAAA records.

https://hexdocs.pm/hackney/1.25.0/hackney.html#request/5

tried playing with these Hackney timeout values when doing my testing, it didn't affect the results. And my test was against a webfinger lookup of @fakeaccount@friedcheese.us which is ~1ms away from my laptop, no AAAA records at all.

@phnt wrote in https://git.pleroma.social/pleroma/pleroma/pulls/7860#issuecomment-114822: > Also when I thought about this more. The long wait could be possibly related to the default `connect_timeout` in Hackney being way too long (8 seconds). Try lowering that and see if the times change and check if the host you are connecting to actually has working IPv6 besides AAAA records. > > https://hexdocs.pm/hackney/1.25.0/hackney.html#request/5 tried playing with these Hackney timeout values when doing my testing, it didn't affect the results. And my test was against a webfinger lookup of @fakeaccount@friedcheese.us which is ~1ms away from my laptop, no AAAA records at all.
feld force-pushed hackney-downgrade from 60b03191f0
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
to 7582b71f46
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
2026-04-08 19:29:20 +00:00
Compare
Author
Owner

Back to 1.20.1 it is, then!

Back to 1.20.1 it is, then!
feld merged commit 683ab39160 into develop 2026-04-08 19:29:51 +00:00
feld deleted branch hackney-downgrade 2026-04-08 19:29:51 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pleroma/pleroma!7860
No description provided.