ruby-concurrency / ruby-concurrency/concurrent-ruby
why use wait_for_termination method will stuck the code
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 5.8k
- Forks
- 420
- Avg merge
- 20h 45m
- Merged PRs (30d)
- 4
Description
user_ids,org,delete_restore = get_org_and_user(delete_restore_id)
return unless user_ids.present?
work_num = [user_ids.length,50].min
thread_pool = Concurrent::FixedThreadPool.new(work_num)
error_map = Concurrent::Map.new
redis_key = RedisClient::DDRS_BULK_DELETE_KEY % org.id ## TODO
set_redis_total_num(redis_key,user_ids.length)
user_ids.each do |id|
thread_pool.post do
#delete_single_user(id,error_map,redis_key)
target_class = ClassFactory.create_dynamic_model("zendmodo", "privacy_settings", true)
puts id
puts target_class
end
end
thread_pool.shutdown
thread_pool.wait_for_termination
the wait_for_termination method will stuck the following code
target_class = ClassFactory.create_dynamic_model("zendmodo", "privacy_settings", true)
- Operating system: linux
- Ruby implementation: Ruby
concurrent-rubyversion: 1.2.0concurrent-ruby-extinstalled: noconcurrent-ruby-edgeused: no
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the thread_pool.shutdown and thread_pool.wait_for_termination calls in the issue's example, then investigate the worker's ClassFactory.create_dynamic_model call under Ruby with concurrent-ruby 1.2.0 and no concurrent-ruby-ext. Reproduce the hang on Linux and establish why the worker does not finish; done means the supplied workload terminates without leaving wait_for_termination stuck.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100