Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Potential concurrency bugs in ConfigManager

Ouverte
#532 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
25/100
Type d'issue
Refactorisation
Clarté
À clarifier
Activité
À l'abandon
Stack technique
go
Domaine
backend

Piste de recherche

Commencez par localiser ConfigManager et les points d’appel de GetConfig et WatchConfig. Examinez la manière dont sont gérés l’initialisation, le blocage des notifications et la durée de vie du watcher ; la tâche sera considérée comme terminée lorsqu’une conception approuvée couvrira les mises à jour manquées, les modules bloqués et la désinscription, avec les tests correspondants.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Go
Étoiles
73
Forks
40
Merge moyen
15 h 43 min
PR mergées (30 j)
9

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de pingcap/tiproxy

Toutes les issues de pingcap/tiproxy

Issues similaires

Plus d'issues Go

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.