Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Potential concurrency bugs in ConfigManager

Aperta
#532 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Refactoring
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
go
Ambito
backend

Direzione di ricerca

Inizia individuando ConfigManager e i punti in cui vengono chiamati GetConfig e WatchConfig. Esamina come vengono gestiti l’inizializzazione, il blocco delle notifiche e il ciclo di vita del watcher; il lavoro sarà considerato completato quando sarà disponibile un design concordato che affronti gli aggiornamenti persi, i moduli bloccati e la disiscrizione, insieme ai test corrispondenti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Development Task

ConfigManager notifies other modules with the config change by a channel. There are some bugs:

  1. When a module starts, it must receive an initial config and a channel as its parameters, such as someModule.Init(cfgMgr.GetConfig(), cfgMgr.WatchConfig()). However, between calling GetConfig() and WatchConfig(), there may be a config change, and thus someModule may miss this config change.
  2. ConfigManager notifies all the modules by writing to the channels when config changes. If one module blocks (maybe forever or temporarily), it hangs. If the module blocks forever, such as deadlock or panic, the config change will block forever. But if you add a timeout on writing the channel, the module may miss the config change if it just blocks temporarily, such as busy handling other things.
  3. There's no way to unsubscribe from ConfigManager after calling WatchConfig(). If a module wants to quit, ConfigManager will still try to notify it.

For the 1st problem, one workaround is calling WatchConfig() after GetConfig().
For the 2nd problem, one workaround is to set the channel size to a big enough size and also set a timeout on writing the channel.
For the 3rd problem, one workaround is to add another function to unsubscribe.

If we deprecate the WatchConfig() way and always use GetConfig(), all problems will be solved.

Lingua principale
Go
Stelle
73
Fork
41
Merge medio
12h 38m
PR unite (30g)
21

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pingcap/tiproxy

Tutte le issue di pingcap/tiproxy

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.