What causes EventMachine::ConnectionNotBound?
-
13-09-2019 - |
Question
I'm new to EventMachine, so I'm not sure what this means. I'm getting this exception:
EventMachine::ConnectionNotBound recieved ConnectionUnbound for an unknown signature: ef93a97d4d6441cb80d30fe2313d7de73
The program is fairly complicated, so I can't really explain everything that might have led up to it. All I need is a pointer towards what to look for. The error doesn't seem to be documented (looking at http://eventmachine.rubyforge.org/).
Solution
I have had this exception raised when some other unhandled exception was raised in the initialize method of a subclass of EventMachine::Connection. Check that the arity of your subclass initialize method is correct and that the initialize method is running without errors.
OTHER TIPS
Usually, those errors occur in initialize or post_init. The first thing you should do is add rescue inside your callbacks to find out what actually is causing that error.
def initialize(*args)
...
super
rescue Exception
...
end
def post_init
...
super
rescue Exception
...
end
I fixed Exception bubbling for this case in EventMachine over a year ago. It's in the prerelease 1.0 gem (gem install eventmachine --pre
) or better, use EventMachine from the repository.
I ran into a similar issue and while investigating came across https://github.com/igrigorik/em-http-request/issues/190#issuecomment-16995528
You basically need to wrap EM::HttpRequest.new
with EM.schedule
or EM.next_tick
if you're making EM::HttpRequest.new
in your code even though its under a EM.defer