Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Celluloid::IO does not respect terminate when reading from a buffer that is always full #90

Open
Burgestrand opened this issue Nov 8, 2013 · 4 comments
Milestone

Comments

@Burgestrand
Copy link

/cc @jnicklas

Here’s a gist of a reproduction case: https://gist.github.com/Burgestrand/7421e529fd92a4889afd

Some caveats about the code in the gist. I tried it on:

  • CRuby 2.0.0-p195
  • JRuby 1.7.4
  • JRuby 1.7.6

For celluloid / celluloid io versions:

  • 0.15.2 / 0.15.0
  • 0.14.1 / 0.14.1

With the following results:

  • CRuby does not work at all. Reader receives connection refused. Not sure why, probably I’m doing something wrong.
  • JRuby 1.7.4 does not terminate the actors, but ^C will shut it down because the JVM shuts down hard.
  • JRuby 1.7.6 does not terminate the actors, and ^C will not shut it down. It will reach the last line of code (reader.terminate returns), but neither the reader nor writer will terminate. Must kill -9, so probably Celluloid.shutdown not working properly here either.

Version of celluloid does not change the results, except 0.15.x will whine more in the log about terminated tasks.

@digitalextremist
Copy link
Member

Is this still an issue @Burgestrand?

@Burgestrand
Copy link
Author

I would assume so, but I will not be at a computer for another 24 hours to test the reproduction case against the newest release of celluloid.

The origin of the bug is based on that the non-blocking read in Celluloid::IO will never yield to the event loop because there is always data to be read from the socket, and because of this it will never receive the mailbox termination message, or any other message for that part. sleep(0) is a relatively sane workaround to yield to the event loop before reading from the socket, but I'm not sure I think it should be necessary.

@digitalextremist
Copy link
Member

I ran your reproduction and I see your issue. This is still affecting jruby-1.7.19

@digitalextremist
Copy link
Member

@Burgestrand thank you for getting back to me on this, and for the beautiful repro... long ago.

@digitalextremist digitalextremist modified the milestone: 0.18.0 Aug 9, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants