-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pool connection not freed when response code is 307 (with example! 🎉 ) #717
Labels
Comments
marcinkoziej
changed the title
Pool connection not freed when response code is 307
Pool connection not freed when response code is 307 (with example! :tada)
Mar 29, 2023
marcinkoziej
changed the title
Pool connection not freed when response code is 307 (with example! :tada)
Pool connection not freed when response code is 307 (with example! 🎉 )
Mar 29, 2023
+1 |
Not sure it's an issue with 307 redirects. The same thing happens when you replace the 307 response with a 200 response in your example. |
To close connections there is need to add hackney:body/1 call after receive an answer, or hackney:skip_body/1 if not interesting in body content. Enum.each 1..51, fn _ ->
{:ok, 307, _, Ref} = :hackney.request(:post, "http://localhost:5000", [], "", [pool: Pool])
_Result = :hackney.skip_body(Ref)
info inspect :hackney_pool.get_stats Pool
end https://github.com/benoitc/hackney/blob/master/src/hackney.erl#L508-L531 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
I managed to track down a situation where
hackney_pool
fills up if the response to POST is 307. I started seeing this in some APIs (SalesForce).Try this example:
Save file below as server.exs and run
elixir server.exs
. It will make a POST 51 times until the last ones timeouts when waiting for the pool.What I am seeing is:
Hope this helps tracking down these pesky connection pool bugs!
The text was updated successfully, but these errors were encountered: