benoitc / hackney

simple HTTP client in Erlang
Other
1.34k stars 427 forks source link

Connection timeout errors #698

Closed SukhikhN closed 5 months ago

SukhikhN commented 3 years ago

Hello!

I'm testing my application behaviour with different network timeouts and getting strange error results when unsig hackney with or without connection pool.

First, for testing connection timeout I set up iptables to drop all packets incoming to port 8080: # iptables -I INPUT -p tcp --dport 8080 -j DROP

Then I try to make requests from the application console:

iex(2)> :hackney.request(:get, "http://localhost:8080", [], "", [pool: false])
{:error, :connect_timeout}
iex(3)> :hackney.request(:get, "http://localhost:8080", [], "", [])           
{:error, :timeout}

As you can see the error reasons are different depending on pool configuration, which seems strange to me - is this correct behaviour?

Also :timeout reason is returned when server is slow to respond - so we can't distinguish response timeout from connection timeout.

I'm testing it using hackney 1.18.0.

benoitc commented 5 months ago

closing as fixed. sorry for the late handling.