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

Supervise fails with Celluloid 0.17 #202

Open
OndroNR opened this issue Jul 20, 2015 · 4 comments
Open

Supervise fails with Celluloid 0.17 #202

OndroNR opened this issue Jul 20, 2015 · 4 comments
Milestone

Comments

@OndroNR
Copy link

OndroNR commented Jul 20, 2015

With Celluloid 0.17.0 this sample code with supervise (simple HTTP.run works) fails (works with Celluloid 0.16):

require 'celluloid/autostart'
require 'reel'

supervisor = Reel::Server::HTTP.supervise('127.0.0.1', 3000) do |connection|
  connection.each_request do |request|
    request.respond :ok, "hello, world!"
  end
end

begin
  sleep
rescue Interrupt
  supervisor.terminate
end

with following log:

D, [2015-07-20T14:40:53.761018 #24009] DEBUG -- : Celluloid 0.17.0 is running in BACKPORTED mode. [ http://git.io/vJf3J ]
D, [2015-07-20T14:40:53.914552 #24009] DEBUG -- : Terminating 5 actors...
E, [2015-07-20T14:40:53.914909 #24009] ERROR -- : Actor crashed!
ArgumentError: 2 vs. -3
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-supervision-0.20.0/lib/celluloid/supervision/validation.rb:21:in `block in valid?'
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-supervision-0.20.0/lib/celluloid/supervision/validation.rb:15:in `each'
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-supervision-0.20.0/lib/celluloid/supervision/validation.rb:15:in `valid?'
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-supervision-0.20.0/lib/celluloid/supervision/deprecate/validation.rb:48:in `options'
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-supervision-0.20.0/lib/celluloid/supervision/deprecate/supervise.rb:96:in `supervise'
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/calls.rb:28:in `public_send'
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/calls.rb:28:in `dispatch'
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/call/sync.rb:16:in `dispatch'
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/cell.rb:50:in `block in dispatch'
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/cell.rb:76:in `block in task'
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/actor.rb:363:in `block in task'
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/task.rb:57:in `block in initialize'
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/task/fibered.rb:14:in `block in create'
    (celluloid):0:in `remote procedure call'
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/call/sync.rb:45:in `value'
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/proxy/sync.rb:40:in `method_missing'
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-supervision-0.20.0/lib/celluloid/supervision/deprecate/supervise.rb:7:in `supervise'
    /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-supervision-0.20.0/lib/celluloid/supervision/deprecate/supervise.rb:19:in `supervise'
    reel_supervision.rb:6:in `<main>'
/home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-supervision-0.20.0/lib/celluloid/supervision/validation.rb:21:in `block in valid?': 2 vs. -3 (ArgumentError)
    from /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-supervision-0.20.0/lib/celluloid/supervision/validation.rb:15:in `each'
    from /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-supervision-0.20.0/lib/celluloid/supervision/validation.rb:15:in `valid?'
    from /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-supervision-0.20.0/lib/celluloid/supervision/deprecate/validation.rb:48:in `options'
    from /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-supervision-0.20.0/lib/celluloid/supervision/deprecate/supervise.rb:96:in `supervise'
    from /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/calls.rb:28:in `public_send'
    from /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/calls.rb:28:in `dispatch'
    from /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/call/sync.rb:16:in `dispatch'
    from /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/cell.rb:50:in `block in dispatch'
    from /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/cell.rb:76:in `block in task'
    from /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/actor.rb:363:in `block in task'
    from /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/task.rb:57:in `block in initialize'
    from /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/task/fibered.rb:14:in `block in create'
    from (celluloid):0:in `remote procedure call'
    from /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/call/sync.rb:45:in `value'
    from /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-0.17.0/lib/celluloid/proxy/sync.rb:40:in `method_missing'
    from /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-supervision-0.20.0/lib/celluloid/supervision/deprecate/supervise.rb:7:in `supervise'
    from /home/ondrej/.rvm/gems/ruby-2.2.2/gems/celluloid-supervision-0.20.0/lib/celluloid/supervision/deprecate/supervise.rb:19:in `supervise'
    from reel_supervision.rb:6:in `<main>'
@digitalextremist
Copy link
Member

Ah, this is a bad behavior of the backported code.

Changing that to this will work for now:

Reel::Server::HTTP.supervise(args:['127.0.0.1', 3000])

@OndroNR
Copy link
Author

OndroNR commented Jul 20, 2015

Thanks for reply, but it doesn't work for me. Same error.

@digitalextremist
Copy link
Member

Do you have any other Celluloid related code in your project? If not, change to:

require 'celluloid/current'

I'll look at this some more in the meantime.

@esborisov
Copy link

In 0.16 this works as expected:

require 'celluloid/autostart'
require 'reel'
Reel::Server::HTTP.supervise("0.0.0.0", 3001) do |connection|
  raise if [false, true].sample
  connection.each_request do |request|
      request.respond :ok, "Hello, world!"
  end
end

however in 0.17.2 this won't restart after crash:

require 'celluloid/current'
require 'reel'
Reel::Server::HTTP.supervise({args: ["0.0.0.0", 3001]}) do |connection|
  raise if [false, true].sample
  connection.each_request do |request|
      request.respond :ok, "Hello, world!"
  end
end

@digitalextremist digitalextremist modified the milestone: triage Feb 16, 2016
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