IO#ensure_open fails in xmpp4r gem #864

Closed
bakkdoor opened this Issue May 10, 2011 · 1 comment

Comments

Projects
None yet
3 participants
Member

bakkdoor commented May 10, 2011

I wanted to try out the xmpp4r gem (see: http://home.gna.org/xmpp4r/).
I provided a simple test script that connects to a xmpp server, tries to authenticate and disconnects. This all works fine under MRI (to actually run this you'll have to use your own xmpp username & password).
But on Rubinius it fails (see gist).
I was able to track it down failing in IO#ensure_open_and_writable when it calls IO#ensure_open (which i found to be a primitive). The C++ code that failed is this:

else if(to_fd() == -1) {
  Exception::io_error(state, "closed stream");
}

No idea why it's workin in MRI but not on rbx. Maybe somehow the open connection stream is accidentally closed by the runtime or something. Different timeouts?
Let me know if you have any further questions.

Gist with error report and sample code: https://gist.github.com/964180

Member

kronos commented May 12, 2011

OK. I found out the problem.

x = Thread.new do
  begin
    loop { sleep 1.0 }
  rescue Exception => e # !!!
    p e.message
  end
end

x.kill
sleep 0.5

Rubinius allows to catch the error and the code outputs "Thread::Die", but both MRI & YARV don't. If we remove "Exception => e" everything works well. I think it's very easy to fix for Brian and Evan :).

@ryoqun ryoqun closed this in ba7667b Sep 27, 2012

roshats added a commit to roshats/rubinius that referenced this issue Jun 26, 2014

Correctly implement Thread#kill
Re-implement Thread#kill by adding new RaiseReason rather than complicating the
existing ad-hoc way of raising Exceptions.

Conceputually, Thread#kill isn't quite like exceptions. If the exception approach
wasn't replaced, it would be neccesary to really specially handle Thread::Die.

Make some failing specs pass. Also, Fix #864.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment