Skip to content

Connection timeout trouble #39

@alexkwolfe

Description

@alexkwolfe

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?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions