Canary deploy times out when autostop stops a Machine between the deploy's two Machine lists
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
The reproduction is TestCanaryAcceptsPreservedStoppedUpdateAfterReread; run it against c6de331 to see the health-check timeout. Read internal/command/deploy/plan.go around the skip_launch decision and stopped-outcome acceptance, then machines_deploymachinesapp.go canary phase two to see which Machine list is passed as originalAppState versus oldAppState. Compare with waitForMachine's launchBasisState. Done when the stopped Machine is accepted and the test passes.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
With --deploy-retries set, a canary deploy timed out at --wait-timeout on Machines that the proxy autostopped during the deploy. flyd left them stopped on update, an outcome PR #5128 accepts, but flyctl compared it against the wrong read of the Machine and waited for health checks instead.
- Operating system: Linux (CI runner)
fly version: observed with 0.4.82, which predates PR #5128. The same sequence still fails at masterc6de331(test below); v0.4.121 has the same code as master here.
** Paste your fly.toml
# Relevant settings only
[deploy]
strategy = "canary"
[http_service]
internal_port = 8080
auto_stop_machines = "stop"
auto_start_machines = true
min_machines_running = 1
[[http_service.checks]]
path = "/health"
interval = "30s"
timeout = "5s"
grace_period = "60s"
** Command output: **
$ fly deploy --image <image> --wait-timeout 8m --deploy-retries 1
[...]
Updating existing machines in '<app>' with canary strategy
[...]
✔ Machine <canary> is now in a good state
[...]
> Updating machine config for <machine-a>
> Updating <machine-a> [app]
> Updated machine config for <machine-a>
> Waiting for machine <machine-a> to reach a good state
> Machine <machine-a> reached stopped state
> Running smoke checks on machine <machine-a>
> Running machine checks on machine <machine-a>
> Checking health of machine <machine-a>
[...]
Error: failed to update machine <machine-a>: Unrecoverable error: timeout reached waiting for health checks to pass for machine <machine-a>: failed to get VM <machine-a>: Get "https://api.machines.dev/v1/apps/<app>/machines/<machine-a>": net/http: request canceled
(IDs replaced, line indexes removed.)
Sequence (seconds after the first Machine list)
- 0: before the canary, flyctl lists the Machines (
oldAppState).<machine-a>and<machine-b>are started. - 52, 65: the proxy autostops them ("has excess capacity, autostopping machine").
- 87: after the canary, flyctl lists the Machines again (
refreshedState). Both are stopped. - 88, 152: flyctl updates them with
skip_launch: false(whatshouldSkipLaunchreturns for a Machine started at the first list). flyd logs "machine was in a non-started state prior to the update so leaving the new version stopped" for each. - flyctl waits for health checks on the stopped Machine and fails 480 s later, at
--wait-timeout.
Expected: flyctl accepts the stopped outcome ("Machine ... was updated and left stopped"), as it does when the autostop lands after the second list.
Actual: flyctl runs smoke, machine and health checks on the stopped Machine and fails at --wait-timeout.
Cause (master c6de331)
updateProcessGroupdecidesskip_launchfromoriginalMachine(plan.go#L370).updateMachineWChecksaccepts a stopped outcome only ifoldMachine.Statewas started (plan.go#L616).- Canary phase two passes the first list as
originalAppStateand the second asoldAppState(machines_deploymachinesapp.go#L754-L759). Deploy retries do the same with their re-read (plan.go#L306-L317).
A Machine that is started at the first list and stopped at the second is therefore updated with skip_launch: false, and its stopped outcome is rejected. With --deploy-retries 0 both decisions use the same read (machines_deploymachinesapp.go#L1035), so that path is not affected.
Reproduction
TestCanaryAcceptsPreservedStoppedUpdateAfterReread runs updateExistingMachinesWRecovery against a fake Machines API. The first list returns both Machines started; the second returns one stopped; after its update that Machine reads as stopped with an update/stopped/flyd event. At c6de331 the test fails with timeout reached waiting for health checks to pass for machine autostopped-machine. The test is in the linked PR; a tests-only patch that applies to c6de331 is available.
Proposed fix
Judge the stopped outcome against the state that decided skip_launch (originalMachine, or oldMachine when there is none), as waitForMachine already does with launchBasisState.
This report and the patch were prepared with an AI assistant.
- 主要言語
- Go
- スター
- 1.7k
- フォーク
- 320
- 平均マージ
- 2日 18時間
- マージ済み PR(30日)
- 72
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
superfly/flyctl のほかの issue
-
feature
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
fly pg create --network follow-ups: launch, fork/restore Flycast IPs, consistent normalization対応中かも @pcbeingused333 が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
certs setup --json should include the DNS records to create, not just the check response対応中かも @Shivansh-S17 が 2 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
fly launch --db mpg fails with "unknown command"対応中かも @miguel-fly が 3 日前に担当しました。 オープンbug launch ux
superfly/flyctl#5387 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
superfly/flyctl の issue をすべて見る
似ている issue
-
Case detail: main-column section headers are hard to distinguish from body text対応中かも @yubessy が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ubie-oss/hecatoncheires#347 ·
メンテナーはふだん 1 日以内に返信
-
[OperatorHub] Add OLM installation method to the documentation #1193対応中かも @NiccoloFei が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
cloudnative-pg/plugin-barman-cloud#1233 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 2 日以内に返信
-
build: make check-linter version tests deterministic対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信