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

IOError: closed stream #44

Closed
romansergey opened this issue Mar 7, 2013 · 4 comments
Closed

IOError: closed stream #44

romansergey opened this issue Mar 7, 2013 · 4 comments

Comments

@romansergey
Copy link

Coming from here: https://github.com/tarcieri/nio4r/issues/18
Reproduction: https://gist.github.com/romansergey/5103388

I've tried with the git versions of celluloid-io, celluloid and reel and it also crashes:

E, [2013-03-07T08:40:10.454000 #20567] ERROR -- : MyServer crashed!
IOError: closed stream
    org/nio4r/Nio4r.java:143:in `register'
    /home/rs/.rvm/gems/jruby-1.7.2/bundler/gems/celluloid-io-ebc8464622e6/lib/celluloid/io/reactor.rb:42:in `wait'
    /home/rs/.rvm/gems/jruby-1.7.2/bundler/gems/celluloid-io-ebc8464622e6/lib/celluloid/io/reactor.rb:21:in `wait_readable'
    org/jruby/RubyBasicObject.java:1665:in `__send__'
    org/jruby/RubyKernel.java:1809:in `public_send'
    /home/rs/.rvm/gems/jruby-1.7.2/bundler/gems/celluloid-adbbbd850998/lib/celluloid/calls.rb:11:in `dispatch'
    /home/rs/.rvm/gems/jruby-1.7.2/bundler/gems/celluloid-adbbbd850998/lib/celluloid/calls.rb:53:in `dispatch'
    /home/rs/.rvm/gems/jruby-1.7.2/bundler/gems/celluloid-adbbbd850998/lib/celluloid/actor.rb:328:in `handle_message'
    /home/rs/.rvm/gems/jruby-1.7.2/bundler/gems/celluloid-adbbbd850998/lib/celluloid/tasks/task_fiber.rb:28:in `initialize'
D, [2013-03-07T08:40:10.504000 #20567] DEBUG -- : Terminating 19 actors...
D, [2013-03-07T08:40:10.577000 #20567] DEBUG -- : Shutdown completed cleanly
@tarcieri
Copy link
Member

tarcieri commented Mar 7, 2013

Okay... let me take a look

@romansergey
Copy link
Author

With the latest checkout I get:
RuntimeError: Cannot use blocks with async yet

I guess this issue now turns into a feature request?

@tarcieri
Copy link
Member

Well, that probably explains part of the source of your problems. We just changed the block semantics so that blocks are called on senders instead of receivers. This probably isn't what you want exactly (there's an option to override it, but it'd be pretty self-defeating in this case)

My suggestion would be to make "fire" actually do what you want, instead of just a placeholder that takes a block.

That said the CancelledKeyException is probably still an issue.

@halorgium
Copy link
Contributor

@romansergey the change in block behaviour was designed to stop developers leaking state via blocks.
You can remove the async call and allow Celluloid to proxy the block execution.
If you think about it, you do not want the TestActor actor to call methods on the request, but instead want it to call the block and have the MyServer actor execute the block.

My updated gist is https://gist.github.com/halorgium/5404407

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants