ThreadError on terminating actor

67 views
Skip to first unread message

Jonas Osborn

unread,
Aug 11, 2016, 7:08:14 PM8/11/16
to Celluloid
New to celluloid and ruby in general so might be basic, but thanks for any help.
Receiving these Errors when trying to terminate an actor and am very confused:

E, [2016-08-11T23:56:47.585372 #8561] ERROR -- : Actor crashed!
ThreadError: Target thread must not be current thread
        /usr/local/rvm/gems/ruby-2.2.4/gems/celluloid-essentials-0.20.5/lib/celluloid/internals/thread_handle.rb:37:in `join'
        /usr/local/rvm/gems/ruby-2.2.4/gems/celluloid-0.17.3/lib/celluloid/actor.rb:97:in `join'
        /usr/local/rvm/gems/ruby-2.2.4/gems/celluloid-0.17.3/lib/celluloid/proxy/actor.rb:28:in `terminate'
        /usr/local/rvm/gems/ruby-2.2.4/gems/celluloid-0.17.3/lib/celluloid/proxy/cell.rb:59:in `terminate'
        /root/pugbot/lib//queue.rb:91:in `finish'
        /root/pugbot/lib//game.rb:45:in `timeout'
        /root/pugbot/lib//game.rb:35:in `block in finish'
        /usr/local/rvm/gems/ruby-2.2.4/gems/celluloid-0.17.3/lib/celluloid/actor.rb:339:in `block in task'
        /usr/local/rvm/gems/ruby-2.2.4/gems/celluloid-0.17.3/lib/celluloid/task.rb:44:in `block in initialize'
        /usr/local/rvm/gems/ruby-2.2.4/gems/celluloid-0.17.3/lib/celluloid/task/fibered.rb:14:in `block in create'

relevant code is here:
queue.rb:
def finish (game)
  game.terminate
end

game.rb:
def timeout
  @queue.finish(Actor.current)
end

not sure if relevant but timeout is called by a timer in game.rb as @timer = after(FINISH_TIMEOUT) { timeout }

Any help much appreciated.
Regards
Jonas

Tom Lahti

unread,
Sep 12, 2016, 4:21:08 PM9/12/16
to Celluloid
You've got a thread telling another thread to tell the calling thread to terminate, which makes no sense.  How is the stack supposed to unwind?

def timeout
  terminate
end

Problem solved.

--
Tom
Reply all
Reply to author
Forward
0 new messages