why use wait_for_termination method will stuck the code

未关闭
#1,004 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
ruby

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

        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-ruby version: 1.2.0
  • concurrent-ruby-ext installed: no
  • concurrent-ruby-edge used: no
主要语言
Ruby
星标
5.8k
派生
420
平均合并
20 小时 45 分钟
30 天内合并 PR
4

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ruby-concurrency/concurrent-ruby 的其他 Issue

查看 ruby-concurrency/concurrent-ruby 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。