Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Failed connection errors are being swallowed up #117

cactus opened this Issue · 2 comments

2 participants


I am having a problem much like issue #96, but in this case when a connection fails (yet the name resolves), a seemingly similar resultant state (zero status, empty error variable) arises.

For example, change the first url in examples/fibred-http.rb file to, and I get a zero status with no error (just like issue #96).

If I do some ugliness, such as adding this to the Fiber block after the first async_fetch, then I can 'see' an error value...

errno = data.instance_variable_get(:"@conn").conn.instance_variable_get(:"@signature")
puts errno
puts EM::ERRNOS[errno]

I get errno of 2, which is Errno::ENOENT (aka 'No such file or directory').

Oddly enough if I try this same mechanism inside an iterator, I get a different errno. 11, which is Errno::EDEADLK ('Resource deadlock avoided').

It looks like the critical code section is around I am not sure if an exception is firing there or not. If it was, I would think the e.message would be making it to the HttpClient @error ivar as part of the close call (alias for on_error). Right?

@igrigorik igrigorik closed this in c172b63

Should do the trick:

> ruby examples/fibered-http.rb

Setting up HTTP request #1
Fetched page #1: 0
Setting up HTTP request #2
Fetched page #2: 200


@mathieuravaux mathieuravaux referenced this issue from a commit in mathieuravaux/em-http-request
@mathieuravaux mathieuravaux Merge remote-tracking branch 'refs/remotes/igrigorik/master'
* refs/remotes/igrigorik/master:
  Add link to sinatra-synchrony
  Add em-eventsource.
  Response failed on a non-standard HTTP response (such as the twitter search API's 420 'Enhance your calm')
  allow reason to be nil
  woops, add status codes file
  return http status alongside response code, closes #118
  don't swallow connection errors, closes #117
  alias close to unbind on connection
  pass through connection errors, closes #96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.