Skip to content

Instantly share code, notes, and snippets.

@mgroebner
Created September 21, 2013 20:56
Show Gist options
  • Save mgroebner/6654091 to your computer and use it in GitHub Desktop.
Save mgroebner/6654091 to your computer and use it in GitHub Desktop.
gem 'celluloid', '0.15.1'
require 'celluloid/autostart'
class Manager
include Celluloid
trap_exit :processor_died
def initialize
puts "manager initialized"
@ready = 2.times.map { Processor.new_link(self) }
end
def start
@ready.each {|processor| processor.async.process}
end
def processor_died(processor, reason)
actor = Processor.new_link(self)
actor.async.fetch
end
end
class Processor
include Celluloid
def initialize(manager)
@manager = manager
end
def process
raise "fatal errrror"
end
end
Manager.supervise_as :manager
@manager = Celluloid::Actor[:manager]
@manager.start
ruby celluloid_trap_exit_penetration.rb
manager initialized
E, [2013-09-21T22:53:13.221000 #5290] ERROR -- : Processor crashed!
RuntimeError: fatal errrror
celluloid_trap_exit_penetration.rb:32:in `process'
org/jruby/RubyKernel.java:1932:in `public_send'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/calls.rb:25:in `dispatch'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/calls.rb:122:in `dispatch'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:322:in `handle_message'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:416:in `task'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/tasks.rb:55:in `initialize'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/tasks/task_fiber.rb:13:in `create'
E, [2013-09-21T22:53:13.221000 #5290] ERROR -- : Processor crashed!
RuntimeError: fatal errrror
celluloid_trap_exit_penetration.rb:32:in `process'
org/jruby/RubyKernel.java:1932:in `public_send'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/calls.rb:25:in `dispatch'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/calls.rb:122:in `dispatch'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:322:in `handle_message'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:416:in `task'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/tasks.rb:55:in `initialize'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/tasks/task_fiber.rb:13:in `create'
E, [2013-09-21T22:53:13.227000 #5290] ERROR -- : Manager crashed!
Celluloid::DeadTaskError: cannot resume a dead task (resuming fiber from different thread)
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/tasks/task_fiber.rb:27:in `deliver'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/tasks.rb:98:in `resume'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/responses.rb:11:in `dispatch'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:327:in `handle_message'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:174:in `run'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:157:in `initialize'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/thread_handle.rb:13:in `initialize'
org/jruby/RubyProc.java:255:in `call'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/internal_pool.rb:100:in `create'
W, [2013-09-21T22:53:13.229000 #5290] WARN -- : Terminating task: type=:exit_handler, meta={:method_name=>:processor_died}, status=:callwait
E, [2013-09-21T22:53:13.230000 #5290] ERROR -- : Processor crashed!
Celluloid::DeadTaskError: cannot resume a dead task (resuming fiber from different thread)
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/tasks/task_fiber.rb:27:in `deliver'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/tasks.rb:98:in `resume'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/responses.rb:11:in `dispatch'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:327:in `handle_message'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:174:in `run'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:157:in `initialize'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/thread_handle.rb:13:in `initialize'
org/jruby/RubyProc.java:255:in `call'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/internal_pool.rb:100:in `create'
E, [2013-09-21T22:53:13.231000 #5290] ERROR -- : Processor crashed!
Celluloid::DeadTaskError: cannot resume a dead task (resuming fiber from different thread)
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/tasks/task_fiber.rb:27:in `deliver'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/tasks.rb:98:in `resume'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/responses.rb:11:in `dispatch'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:327:in `handle_message'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:174:in `run'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:157:in `initialize'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/thread_handle.rb:13:in `initialize'
org/jruby/RubyProc.java:255:in `call'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/internal_pool.rb:100:in `create'
W, [2013-09-21T22:53:13.231000 #5290] WARN -- : Terminating task: type=:exit_handler, meta={:method_name=>:processor_died}, status=:callwait
manager initialized
E, [2013-09-21T22:53:13.233000 #5290] ERROR -- : Manager: CLEANUP CRASHED!
Celluloid::DeadTaskError: cannot resume a dead task (resuming fiber from different thread)
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/tasks/task_fiber.rb:27:in `deliver'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/tasks.rb:98:in `resume'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/tasks.rb:124:in `terminate'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/tasks/task_fiber.rb:32:in `terminate'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:404:in `cleanup'
org/jruby/RubyArray.java:1617:in `each'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:404:in `cleanup'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:375:in `shutdown'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:367:in `handle_crash'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:187:in `run'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/actor.rb:157:in `initialize'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/thread_handle.rb:13:in `initialize'
org/jruby/RubyProc.java:255:in `call'
/Users/matt/.rvm/gems/jruby-1.7.4@tickaroo/gems/celluloid-0.15.1/lib/celluloid/internal_pool.rb:100:in `create'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment