notifier: group state is mutated under read locks from concurrent goroutines (potential fatal concurrent map write)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Inizia in coordinator.go, in corrispondenza di responseLoop (intorno alla riga 407), checkAndSendResponseToModules e notifyModule, quindi confronta la correzione relativa al locking in issue #867. Determina come rendere sicuro il check-and-set di ID, Start e LastNotify senza lasciare l’invio delle notifiche sotto un lock inutilmente ampio; il lavoro è completato quando le risposte concorrenti non possono entrare in race né provocare scritture fatali nelle map.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
checkAndSendResponseToModules is spawned as a goroutine per evaluator response (responseLoop, coordinator.go:407), so multiple instances run concurrently by design. Each holds only read locks (nc.clusterLock.RLock() + cluster.Lock.RLock()) while mutating shared per-group state:
cgroup.IDandcgroup.Startare written at coordinator.go:430-434 and 454-458 under the read lock.notifyModule(called synchronously from there, still under the same read locks) writes to thecgroup.LastNotifymap at coordinator.go:548 and 566.
Read locks don't exclude each other, so two concurrent responses for the same group can write cgroup.ID/Start racily and — worse — perform concurrent writes to the same LastNotify map. Concurrent map writes are a fatal, unrecoverable runtime error in Go (fatal error: concurrent map writes), which would take down the whole Burrow process.
Two responses for the same group can be in flight at once, e.g. when two sendEvaluatorRequests loops briefly overlap after a ZooKeeper session bounce (manageEvalLoop starts a new loop once it reacquires the ZK lock while the old one is still mid-iteration), or whenever response processing is slower than the evaluation interval.
Why not just a PR
The minimal fix — upgrading cluster.Lock.RLock() to Lock() in checkAndSendResponseToModules — is a one-line change, but it would hold the cluster's write lock across module.Notify() calls (HTTP/email sends), serializing notification dispatch per cluster and blocking the evaluation loop for that cluster while a slow notifier runs. Alternatives:
- Accept the serialization (correctness over throughput; notify calls are usually fast).
- Restructure so the
LastNotify/ID/Startcheck-and-set happens under a short write lock andNotify()is called after release (the status/startTime/eventID are already passed by value). - Give
consumerGroupits own small mutex forID/Start/LastNotify.
Option 2 seems cleanest but touches the send-once/send-interval logic, so I wanted maintainer input on the preferred direction before sending a PR. Happy to implement whichever is preferred.
Related: #867 fixes the same pattern (write under read lock) in sendEvaluatorRequests, where the fix has no locking tradeoff.
Burrow version: master (60d5782)
- Lingua principale
- Go
- Stelle
- 4k
- Fork
- 816
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna 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 linkedin/Burrow
-
[Bug]: createRecursive exits early when an intermediate ZooKeeper path already existsForse già presa @Samri-A l’ha presa 9 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
Remove Gopkg.lock from repoAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
Tutte le issue di linkedin/Burrow
Issue simili
-
Client execution contract accepts a grant the code never takesForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaarea: client enhancement priority: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
opensro-dev/opensro#3808 ·
I maintainer di solito rispondono entro 1 giorno
-
severity: low tech-debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
TMHSDigital/subenum#414 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 2 giorni
-
hive size:simple
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
Edwin-metcalf/MetCode#54 ·
I maintainer di solito rispondono entro 1 giorno