ruby-concurrency / ruby-concurrency/concurrent-ruby

why use wait_for_termination method will stuck the code

Offen
#1,004 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Ruby
Sterne
5.8k
Forks
420
Ø Merge
20 Std. 45 Min.
Gemergte PRs (30 T.)
4

Beschreibung

        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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
ruby
Bereich
distributed-systems
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.