Skip to content
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 timeout trouble #39

Open
alexkwolfe opened this issue Jun 13, 2012 · 3 comments
Open

Connection timeout trouble #39

alexkwolfe opened this issue Jun 13, 2012 · 3 comments

Comments

@alexkwolfe
Copy link

My understanding is that when EM::Mongo::Connection is instantiated with the timeout parameter that an error should be raised if a connection cannot be established in that time. It looks like that's not happening.

Looking at the initializer for Connection confirms that the errback should raise the "failure with mongodb server..." error. The errback is never called, though. The reason is that the timeout timer is cancelled when the connection's unbind method calls set_deferred_status(nil). So the timeout timer never fires.

You can confirm the problem by stopping your mongod process and running the following code. I think it should raise an error, but it does not.

require 'em-mongo'
require 'eventmachine'

EM.run do
  EM::Mongo::Connection.new('localhost', 27017, 1)
end

It's not obvious to me how, exactly, to fix this. Any suggestions?

@halilim
Copy link

halilim commented Apr 23, 2014

Any comments on this?

@bcg
Copy link
Owner

bcg commented Apr 23, 2014

@jsaak has taken over maintenance duties recently. @jsaak want to have a look?

@dCSeven
Copy link
Collaborator

dCSeven commented Apr 13, 2018

I now have the same issue, which causes em-mongo to silently fail without any indication that it failed.

It seems that all other database commands just don't execute too, since callbacks and errbacks don't get executed.

This is a serious problem, where something needs to be done.
I'll try to fix it when time allows it.

Note that this does only occur when the connections don't stay open long enough to experience the timeout before they end again.

@dCSeven dCSeven added the bug label Apr 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants