Skip to content

Actors on Pool raise an error #620

@ondra-m

Description

@ondra-m

Actor does not work if its part of Pool.

class IOWorker < Concurrent::Actor::Context
  def on_message(io_job)
    # do IO work
    sleep 0.1
    puts "#{path} second:#{(Time.now.to_f*100).floor} message:#{io_job}"
  end

  def default_executor
    Concurrent.global_io_executor
  end
end 

pool = Concurrent::Actor::Utils::Pool.spawn('pool', 2) do |index|
  IOWorker.spawn(name: "worker-#{index}")
end

pool << 1 << 2 << 3 << 4 << 5 << 6

Error:

undefined method `on_blocker_resolution' for nil:NilClass (NoMethodError)
concurrent-ruby-edge-0.3.0/lib/concurrent/edge/promises.rb:789:in `callback_notify_blocked'
concurrent-ruby-edge-0.3.0/lib/concurrent/edge/promises.rb:767:in `call_callback'
concurrent-ruby-edge-0.3.0/lib/concurrent/edge/promises.rb:734:in `add_callback'
concurrent-ruby-edge-0.3.0/lib/concurrent/edge/promises.rb:1386:in `ensure in new_blocked_by1'
concurrent-ruby-edge-0.3.0/lib/concurrent/edge/promises.rb:1386:in `new_blocked_by1'
concurrent-ruby-edge-0.3.0/lib/concurrent/edge/promises.rb:613:in `chain_on'
concurrent-ruby-edge-0.3.0/lib/concurrent/edge/promises.rb:595:in `chain'
concurrent-ruby-edge-0.3.0/lib/concurrent/edge/promises.rb:124:in `future_on'
concurrent-ruby-edge-0.3.0/lib/concurrent/edge/promises.rb:110:in `future'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/utils/pool.rb:46:in `on_message'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/context.rb:46:in `on_envelope'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/behaviour/executes_context.rb:7:in `on_envelope'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/behaviour/abstract.rb:25:in `pass'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/behaviour/awaits.rb:15:in `on_envelope'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/behaviour/abstract.rb:25:in `pass'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/behaviour/supervising.rb:33:in `on_envelope'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/behaviour/abstract.rb:25:in `pass'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/behaviour/pausing.rb:38:in `on_envelope'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/behaviour/abstract.rb:25:in `pass'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/behaviour/linking.rb:60:in `on_envelope'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/behaviour/abstract.rb:25:in `pass'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/behaviour/termination.rb:55:in `on_envelope'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/behaviour/abstract.rb:25:in `pass'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/behaviour/removes_child.rb:10:in `on_envelope'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/behaviour/abstract.rb:25:in `pass'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/behaviour/sets_results.rb:14:in `on_envelope'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/core.rb:161:in `process_envelope'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/core.rb:95:in `block in on_envelope'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/core.rb:118:in `block (2 levels) in schedule_execution'
concurrent-ruby-1.0.4/lib/concurrent/synchronization/mri_lockable_object.rb:38:in `block in synchronize'
concurrent-ruby-1.0.4/lib/concurrent/synchronization/mri_lockable_object.rb:38:in `synchronize'
concurrent-ruby-1.0.4/lib/concurrent/synchronization/mri_lockable_object.rb:38:in `synchronize'
concurrent-ruby-edge-0.3.0/lib/concurrent/actor/core.rb:115:in `block in schedule_execution'
concurrent-ruby-1.0.4/lib/concurrent/executor/serialized_execution.rb:18:in `call'
concurrent-ruby-1.0.4/lib/concurrent/executor/serialized_execution.rb:18:in `call'
concurrent-ruby-1.0.4/lib/concurrent/executor/serialized_execution.rb:96:in `work'
concurrent-ruby-1.0.4/lib/concurrent/executor/serialized_execution.rb:77:in `block in call_job'
concurrent-ruby-1.0.4/lib/concurrent/executor/ruby_thread_pool_executor.rb:348:in `call'
concurrent-ruby-1.0.4/lib/concurrent/executor/ruby_thread_pool_executor.rb:348:in `run_task'
concurrent-ruby-1.0.4/lib/concurrent/executor/ruby_thread_pool_executor.rb:337:in `block (3 levels) in create_worker'
concurrent-ruby-1.0.4/lib/concurrent/executor/ruby_thread_pool_executor.rb:320:in `loop'
concurrent-ruby-1.0.4/lib/concurrent/executor/ruby_thread_pool_executor.rb:320:in `block (2 levels) in create_worker'
concurrent-ruby-1.0.4/lib/concurrent/executor/ruby_thread_pool_executor.rb:319:in `catch'
concurrent-ruby-1.0.4/lib/concurrent/executor/ruby_thread_pool_executor.rb:319:in `block in create_worker'

Tested on MRI 2.2.5, 2.3.3, 2.4


  • Operating system: linux
  • concurrent-ruby version: 1.0.4
  • concurrent-ruby-ext installed: no
  • concurrent-ruby-edge used: 0.3.0

Metadata

Metadata

Assignees

Labels

bugA bug in the library or documentation.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions