Data race on color.NoColor when commands run concurrently
メンテナーはふだん 1 日以内に返信
@dandavison がすでに取り組んでいます。
2026年6月11日 から。
評価
この issue はまだ評価されていません。
説明
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.
- 主要言語
- Go
- スター
- 390
- フォーク
- 123
- 平均マージ
- 2日 9時間
- マージ済み PR(30日)
- 13
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
temporalio/cli のほかの issue
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
temporalio/cli#776 ·
メンテナーはふだん 1 日以内に返信
-
[Feature Request] Option to disable metrics in server start-dev対応中かも @shafiktanbir が 11 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 67/100
temporalio/cli#1274 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 58/100
temporalio/cli#1249 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Feature Request] Decode workflow histories concurrently with remote codec servers対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンenhancement
難易度 4/5 3〜5日 初心者へのやさしさ 65/100
temporalio/cli#1193 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
temporalio/cli#1178 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
seriousm4x/UpSnap#1786 ·
-
bug feedback ui/ux
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
peasant-labs/peasant#1307 ·
メンテナーはふだん 1 日以内に返信
-
Reformat test names for single-protocol tests to start with Protocol/, i.e. gRPC/ or Websocket/オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
connectrpc/conformance#1211 ·
メンテナーはふだん 1 日以内に返信
-
bug effort:s impact:med raised-by:desk risk:low
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
medici-finance/assay#8342 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
hardening
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
inference-sim/inference-sim#2821 ·
メンテナーはふだん 1 日以内に返信