Changing Celluloid.task_class crashes Reel
Opened this issue · 4 comments
If Celluloid's task class is changed to Celluloid::TaskThread
before Reel is loaded, then Reel crashes. I'm not sure if this happens in every instance, but it is easily reproduced using the example from the Webmachine Reel Adapted example on the wiki:
require 'celluloid'
require 'celluloid/autostart'
Celluloid.task_class = Celluloid::TaskThread
require 'reel'
require 'webmachine'
class MyHome < Webmachine::Resource
def to_html
"<html><body><p>Aloha!</p></body></html>"
end
end
MyApp = Webmachine::Application.new do |app|
app.routes do
add ['*'], MyHome
end
app.configure do |config|
config.port = 3000
config.adapter = :Reel
end
end
MyApp.run
If you change the adapter to anything other than :Reel
, it works fine. Tested using Reel 0.5.0 and Webmachine 1.3.1.
@kylekyle do you have a backtrace of the exception raised?
No stack trace, it just shuts down. As soon as a client connects, all Celluloid::Actor instances terminate:
D, [2015-03-09T19:41:16.832265 #3974] DEBUG -- : Terminating 6 actors...
And then a few seconds later:
E, [2015-03-09T19:41:26.833128 #3974] ERROR -- : Couldn't cleanly terminate all actors in 10 seconds!
/Users/kyle/.rvm/gems/ruby-2.1.2/gems/celluloid-0.16.0/lib/celluloid/thread_handle.rb:37:in `sleep': No live threads left. Deadlock? (fatal)
from /Users/kyle/.rvm/gems/ruby-2.1.2/gems/celluloid-0.16.0/lib/celluloid/thread_handle.rb:37:in `wait'
from /Users/kyle/.rvm/gems/ruby-2.1.2/gems/celluloid-0.16.0/lib/celluloid/thread_handle.rb:37:in `block in join'
from /Users/kyle/.rvm/gems/ruby-2.1.2/gems/celluloid-0.16.0/lib/celluloid/thread_handle.rb:37:in `synchronize'
from /Users/kyle/.rvm/gems/ruby-2.1.2/gems/celluloid-0.16.0/lib/celluloid/thread_handle.rb:37:in `join'
from /Users/kyle/.rvm/gems/ruby-2.1.2/gems/celluloid-0.16.0/lib/celluloid/actor.rb:96:in `join'
from /Users/kyle/.rvm/gems/ruby-2.1.2/gems/webmachine-1.3.1/lib/webmachine/adapters/reel.rb:36:in `run'
from /Users/kyle/.rvm/gems/ruby-2.1.2/gems/webmachine-1.3.1/lib/webmachine/application.rb:53:in `run'
from test.rb:26:in `<main>'
If I comment out config.adapter = :Reel
it works wonderfully.
Understood.
Do you mind listing the various versions of what you're using? Reel, Celluloid & Celluloid::IO, the underlying Ruby VM, WebMachine, etc?
MacBook-Air:reel-bug kyle$ rvm --version
rvm 1.26.10 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
MacBook-Air:reel-bug kyle$ ruby --version
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
MacBook-Air:reel-bug kyle$ gem list
*** LOCAL GEMS ***
as-notifications (1.0.1)
bigdecimal (1.2.6)
bundler (1.8.3)
bundler-unload (1.0.2)
celluloid (0.16.0)
celluloid-io (0.16.2)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
hitimes (1.2.2)
http (0.7.2)
http-form_data (1.0.0)
http_parser.rb (0.6.0)
i18n (0.7.0)
io-console (0.4.3)
json (1.8.1)
minitest (5.4.3)
multi_json (1.11.0)
nio4r (1.1.0)
power_assert (0.2.2)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
reel (0.5.0)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
test-unit (3.0.8)
timers (4.0.1)
webmachine (1.3.1)
websocket_parser (1.0.0)