Deadlock in Concurrent::Array's on non-MRI
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
Start with the linked gist and the Concurrent::Array documentation, then reproduce the behavior on MRI, JRuby, Rubinius, and TruffleRuby. Compare block-taking methods on Concurrent::Array and Concurrent::Hash; done requires a maintainer decision on intended locking semantics and whether behavior should be consistent across implementations.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
concurrent-rubyversion: 1.0.4concurrent-ruby-extinstalled: noconcurrent-ruby-edgeused: no
Take the following code: https://gist.github.com/eregon/323890bfff539f8a33f66d8b2f02cc99
Of course, its purpose is to create a deadlock but it means any method taking a block on Array can cause a deadlock as long as:
- 2+ threads use 2+
Concurrent::Arrayby calling a method taking a block - inside the blocks, the threads call any method taking on another
Concurrent::Array
This seems not such a rare scenario, as it is frequent to call methods in a block that do not only involve the current Array.
The deadlock does not happen on MRI, as it uses a single global lock and concurrent-ruby just subclasses ::Array. It does happen on all other implementations though, like JRuby, Rubinius and TruffleRuby.
The documentation says:
A thread-safe subclass of Array.
This version locks against the object itself for every method call,
ensuring only one thread can be reading or writing at a time.
This includes iteration methods like #each.
So indeed this might imply the deadlock above, but it's not clear.
ensuring only one thread can be reading or writing at a time is also inaccurate on MRI for methods taking a block, as they release the GIL and might switch to another Thread in the middle of e.g. #each.
The same apply for Hash.
Is this behavior intended? Should this be fixed?
Should it behave the same on the different implementations?
- Lingua principale
- Ruby
- Stelle
- 5.8k
- Fork
- 420
- Merge medio
- 20h 45m
- PR unite (30g)
- 4
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ruby-concurrency/concurrent-ruby
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
ruby-concurrency/concurrent-ruby#1118 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
ruby-concurrency/concurrent-ruby#1099 · 9 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
ruby-concurrency/concurrent-ruby#1095 · 8 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
ruby-concurrency/concurrent-ruby#1093 · 3 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
ruby-concurrency/concurrent-ruby#1091 ·
Tutte le issue di ruby-concurrency/concurrent-ruby
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
バグ
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Version bump for OpenVox 9 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
voxpupuli/puppet-epel#186 · 1 commento ·