-
Notifications
You must be signed in to change notification settings - Fork 14
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
Reactor dies unexpectedly #22
Comments
Ione version is 1.2 (using cassandra-driver 1.0.0) |
Yes, it looks like there is a possibility that a socket can be closed between the I have two solutions to this, but first a workaround: schedule a timer and close sockets in the callback. reactor.schedule_timer(0).on_complete do
session.close
end The handler is always called from the reactor thread so this ensures that the socket is properly closed without any racing. The simplest fix to the underlying issue is to remove line 32 of Could you try that out and see if it helps? If it does I can make a bug fix release. A better solution is to rewrite socket operations so that they are always performed from the reactor thread. This is basically what happens when connecting or writing; the action is buffered and only performed when the socket is ready. |
I've introduced your suggestion here datastax/ruby-driver@8c45eee, this should resolve issues that we faced in the ruby-driver. I do think that the simples quickfix is to not set Thanks for your help! |
I'll re-open this to use as a reminder to fix the underlying issue. The workaround should be applicable to all users of Ione in the meantime, if someone stumbles on this issue, |
after modifying
io_reactor.rb
by adding the following on line 136:I get the following error:
The issue is that the connections are created and closed from different threads, here is a trimmed down sample that consistently fails on linux, while passing on OS X:
I believe there is a race between
close
andconnected?
that causes a closing socket to be added to the poll list.The text was updated successfully, but these errors were encountered: