Skip to content

undefined method `docs' for :disconnected:Symbol (NoMethodError) #48

@wolframarnold

Description

@wolframarnold

Whenever EM::stop is run, the unbind handler seems to produce this stacktrace:

/Users/wolfram/.rvm/gems/ruby-1.9.3-p448@handl-server/gems/em-mongo-0.4.3/lib/em-mongo/collection.rb:739:in `block in safe_send': undefined method `docs' for :disconnected:Symbol (NoMethodError)
from /Users/wolfram/.rvm/gems/ruby-1.9.3-p448@handl-server/gems/em-mongo-0.4.3/lib/em-mongo/connection.rb:186:in `call'
from /Users/wolfram/.rvm/gems/ruby-1.9.3-p448@handl-server/gems/em-mongo-0.4.3/lib/em-mongo/connection.rb:186:in `block in unbind'
from /Users/wolfram/.rvm/gems/ruby-1.9.3-p448@handl-server/gems/em-mongo-0.4.3/lib/em-mongo/connection.rb:186:in `each'
from /Users/wolfram/.rvm/gems/ruby-1.9.3-p448@handl-server/gems/em-mongo-0.4.3/lib/em-mongo/connection.rb:186:in `unbind'
from /Users/wolfram/.rvm/gems/ruby-1.9.3-p448@handl-server/gems/eventmachine-1.0.3/lib/eventmachine.rb:1440:in `event_callback'
from /Users/wolfram/.rvm/gems/ruby-1.9.3-p448@handl-server/gems/eventmachine-1.0.3/lib/eventmachine.rb:194:in `release_machine'
from /Users/wolfram/.rvm/gems/ruby-1.9.3-p448@handl-server/gems/eventmachine-1.0.3/lib/eventmachine.rb:194:in `run'
from /Users/wolfram/.rvm/gems/ruby-1.9.3-p448@handl-server/gems/em-synchrony-1.0.3/lib/em-synchrony.rb:38:in `synchrony'

Looking at the code of EMConnection#unbind#, it seems that it's the @responses array holds something other than callable objects:

    def unbind
      if @is_connected
        @responses.values.each { |resp| resp.call(:disconnected) }
        ...

What goes wrong here?

Update: I noticed that this only happens if an insert statement was run immediately prior to calling close on the connection/prior to EM::stop. If there are no pending writes, it unbinds cleanly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions