Fix race in hackney_pool in hackney 4.2.1#869
Merged
Conversation
benoitc
approved these changes
Jun 6, 2026
Owner
benoitc
left a comment
There was a problem hiding this comment.
Reviewed and verified. I reproduced the crash (pool dies on the noproc from is_ready/1 when a pooled connection dies right after the is_process_alive/1 check) and confirmed this fix resolves it. The try/catch matches the existing defensive calls in this module (stop_conn/1 and the is_upgraded_ssl/is_no_reuse checks in do_checkin). Follow-up with a regression test and a small whitespace/comment tidy coming in a separate PR.
benoitc
added a commit
that referenced
this pull request
Jun 7, 2026
hackney_pool: regression test for the noproc race (#869)
Owner
|
Thanks for the patch ! Hackney 4.2.2 is out with it :) |
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.
In some cases on flaky network connection can die after livness check with
noproc, which crashes pool.It looks like a race, where connection dies between calls to it. This fix tries to eliminate crash by forcing creation of new connection in case when no connection with given Pid already exists.