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
"Connection Refused" and "Operation Timed Out" missing in response #440
Comments
There is also |
Doesn't help either, similar "couldn't connect" message without saying the connection was refused :(
|
Thats all I know. Btw what is the difference? |
"Connection Refused" means there is nothing listening on the port and the server has refused the connection, "Couldn't connect" could mean anything - maybe the server is not pinging at all, maybe the server is silently dropping the request, maybe the web server is responding too slowly, etc - so if there is an intermittent issue it would be difficult to figure out what is going on from the logs. |
Thanks for the explanation although I still don't understand how all these things are different from a client perspective.
Which indicates that it is the same after all. |
I'm looking for an HTTP library to use to communicate between RESTful services. When something goes wrong - as it often does with my code, heh - it helps to know what it was by looking at the logs and "couldn't_connect" is not very helpful/useful :( Even an exception like Errno::ECONNREFUSED would be more helpful than a generic error which doesn't say very much. |
It sounds like Typhoeus might not be what you are looking for. |
Typhoeus doesn't raise exceptions like these on purpose btw. |
I prefer not to have exceptions too, but I need some kind of information as to why the request failed :( |
There are plenty in Typhoeus - more in any other client I know. I think your example is impossible to tell apart for clients. Even your example
is basically saying the same like Typhoeus. Which is not surprising since they are using the fundamentals: libcurl. |
It isn't, it's saying "Connection refused" - that is the bit I am after but I cannot get it in typhoeus - "Connection refused" is very descriptive, it says the operating system refused the connection to the port. "couldnt_connect" says nothing. Why couldn't it connect? |
Yes it is not saying the same. But the error number points to the same underlying problem: |
@Hackeron Have a look at: http://curl.haxx.se/libcurl/c/libcurl-errors.html There's no "connection refused" error code for these cases, just Typhoeus simply forwards the information The discrepancy between the |
Not true, it is not making an assumption. For example, even when a connection times out in Typhoeus, it still does not return the reason for why it could not connect:
On the other hand curl, wget, telnet, etc, etc and several ruby HTTP libraries I tried all give you a reason, some examples:
I think this is quite a serious omission in typhoeus that needs to be addressed (even if outside of libcurl). Because except for this issue, this library is perfect for my use. It was a serious enough issue for the curl CLI to address it too. |
You are correct on that front, sometimes it returns I do believe that this issue is separate from your original one as there doesn't seem to be an error code for a refused connection in I'd also quite like to know about the inconsistent return codes for timed out operations though. |
Thank you :) - I edited the title and description to better reflect the issue I am seeing - I am actually not seeing operation_timeout at all, it's returning couldnt_connect for tcp connection timeouts. |
I remember it doing that and there's code in my system to account for that behavior (checks for both There are multiple phases during each request that can time-out so I guess it depends on when it happens. There may be a DNS resolution timeout, a connection timeout, an HTTP response time out or the combination of all those operations violating the given timeout. |
From the command line:
But in typhoeus:
It seems Typhoeus does not give a reason for why it failed to connect and it is impossible to distinguish a connection refused from a connection timed out. On the other hand curl, wget, telnet, etc, etc and several ruby HTTP libraries I tried all give you a reason, a couple of examples:
I think this is quite a serious omission in typhoeus that needs to be addressed (even if outside of libcurl). Because except for this issue, this library is perfect for my use.
It was a serious enough issue for the curl CLI to address it too it seems.
The text was updated successfully, but these errors were encountered: