Data race on color.NoColor when commands run concurrently
Les mainteneurs répondent en général sous 1 jour
@dandavison y travaille déjà.
Depuis le 11/6/2026.
Évaluation
Cette issue n'a pas encore été évaluée.
Description
What's wrong
initCommand in internal/temporalcli/commands.go uses the global color.NoColor from github.com/fatih/color as scratch space. It saves the current value into origNoColor (around line 476), the PersistentPreRunE closure overwrites it based on the --color flag and JSON output, and PersistentPostRun puts it back (line 513).
That's fine for the real CLI, where each invocation is its own process. But the tests run commands concurrently in one process, and then those saves, overwrites and restores race against each other. TestServer_StartDev_ConcurrentStarts is the one that hits it.
Repro
go test -run TestServer_StartDev_ConcurrentStarts -race ./internal/temporalcli/
Race trace
WARNING: DATA RACE
Read at 0x000127f6a36d by goroutine 36941:
github.com/temporalio/cli/internal/temporalcli.(*TemporalCommand).initCommand()
internal/temporalcli/commands.go:476
github.com/temporalio/cli/internal/temporalcli.Execute()
internal/temporalcli/commands.go:373
Previous write at 0x000127f6a36d by goroutine 68:
github.com/temporalio/cli/internal/temporalcli.(*TemporalCommand).initCommand.func2()
internal/temporalcli/commands.go:513
Notes
Found this while fixing #581. IDK if there is a quick fix since color.NoColor is a package global in a third-party library and concurrent commands can't each keep their own value. Either the pre-run/post-run color block needs serializing, or the color preference should live on CommandContext instead of the global.
- Langage dominant
- Go
- Étoiles
- 390
- Forks
- 123
- Merge moyen
- 2 j 9 h
- PR mergées (30 j)
- 13
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de temporalio/cli
-
enhancement
Difficulté 1/5 Moins d'une heure Accessibilité débutants 70/100
temporalio/cli#776 ·
Les mainteneurs répondent en général sous 1 jour
-
[Feature Request] Option to disable metrics in server start-devPeut-être pris @shafiktanbir l’a pris il y a 11 jours. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 67/100
temporalio/cli#1274 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 58/100
temporalio/cli#1249 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
[Feature Request] Decode workflow histories concurrently with remote codec serversPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverteenhancement
Difficulté 4/5 3-5 jours Accessibilité débutants 65/100
temporalio/cli#1193 ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 38/100
temporalio/cli#1178 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de temporalio/cli
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
seriousm4x/UpSnap#1786 ·
-
bug feedback ui/ux
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
peasant-labs/peasant#1307 ·
Les mainteneurs répondent en général sous 1 jour
-
Reformat test names for single-protocol tests to start with Protocol/, i.e. gRPC/ or Websocket/Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
connectrpc/conformance#1211 ·
Les mainteneurs répondent en général sous 1 jour
-
bug effort:s impact:med raised-by:desk risk:low
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
medici-finance/assay#8342 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
hardening
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
inference-sim/inference-sim#2821 ·
Les mainteneurs répondent en général sous 1 jour