Canary deploy times out when autostop stops a Machine between the deploy's two Machine lists
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 70/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Go
- Estrellas
- 1.7k
- Forks
- 320
- Merge medio
- 2 d 18 h
- PR fusionados (30 d)
- 72
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de superfly/flyctl
-
feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
fly pg create --network follow-ups: launch, fork/restore Flycast IPs, consistent normalizationPosiblemente ocupada @pcbeingused333 la tomó hace 1 día. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
-
certs setup --json should include the DNS records to create, not just the check responsePosiblemente ocupada @Shivansh-S17 la tomó hace 2 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
-
fly launch --db mpg fails with "unknown command"Posiblemente ocupada @miguel-fly la tomó hace 3 días. Abiertobug launch ux
superfly/flyctl#5387 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
`tokens create machine-exec`: metadata-only `secrets list` is denied despite the read fallbackAbiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
Todos los issues de superfly/flyctl
Issues similares
-
Case detail: main-column section headers are hard to distinguish from body textPosiblemente ocupada @yubessy la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ubie-oss/hecatoncheires#347 ·
Los mantenedores suelen responder en 1 día
-
[OperatorHub] Add OLM installation method to the documentation #1193Posiblemente ocupada @NiccoloFei la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
cloudnative-pg/plugin-barman-cloud#1233 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 2 días
-
build: make check-linter version tests deterministicPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día