Skip to content

Deadlock on wait_for_termination #703

@EarlofLemongrab

Description

@EarlofLemongrab

Hey, I have a deadlock problem, code snippet like this:

thread_pool = Concurrent::FixedThreadPool.new(3)
res = Concurrent::ThreadLocalVar.new({})
while @queue.size > 0 do
  thread_pool.post do
    cur = @queue.pop
    build_res = start(cur)
    do_sth(res)
  end
end
thread_pool.shutdown
thread_pool.wait_for_termination

Then here is what I got:

/RHEL5_64/DEV.STD.PTHREAD/build/private/env/ruby2.3.x/ruby2.3.x/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/mri_lockable_object.rb:43:in `sleep': No live threads left. Deadlock? (fatal)
	from /RHEL5_64/DEV.STD.PTHREAD/build/private/env/ruby2.3.x/ruby2.3.x/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/mri_lockable_object.rb:43:in `wait'
	from RHEL5_64/DEV.STD.PTHREAD/build/private/env/ruby2.3.x/ruby2.3.x/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/mri_lockable_object.rb:43:in `ns_wait'
	from RHEL5_64/DEV.STD.PTHREAD/build/private/env/ruby2.3.x/ruby2.3.x/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/abstract_lockable_object.rb:43:in `ns_wait_until'
	from RHEL5_64/DEV.STD.PTHREAD/build/private/env/ruby2.3.x/ruby2.3.x/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/event.rb:87:in `block in wait'
	from RHEL5_64/DEV.STD.PTHREAD/build/private/env/ruby2.3.x/ruby2.3.x/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/mri_lockable_object.rb:38:in `block in synchronize'
	from RHEL5_64/DEV.STD.PTHREAD/build/private/env/ruby2.3.x/ruby2.3.x/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/mri_lockable_object.rb:38:in `synchronize'
	from RHEL5_64/DEV.STD.PTHREAD/build/private/env/ruby2.3.x/ruby2.3.x/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/mri_lockable_object.rb:38:in `synchronize'
	from RHEL5_64/DEV.STD.PTHREAD/build/private/env/ruby2.3.x/ruby2.3.x/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/event.rb:84:in `wait'
	from RHEL5_64/DEV.STD.PTHREAD/build/private/env/ruby2.3.x/ruby2.3.x/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_executor_service.rb:49:in `wait_for_termination'
	from package_builder.rb:64:in `bulk_build'
	from lib/test.rb:152:in `<main>'
rake aborted!

Can someone help me out?

Metadata

Metadata

Assignees

No one assigned

    Labels

    pendingWaiting for response, blocked by other problem, etc.questionAn user question, does not change the library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions