boot.shwait_for polled on a fixed try count (HEALTH_TRIES=90, ~450s worst case), which exceeded photoreport-boot.service's TimeoutStartSec. When the API a container depends on was briefly down, wait_for never got 200, systemd timed the oneshot out, killed the whole cgroup — including the PM2 daemon boot.sh had just launched — and left nginx with no upstream (502) that never self-healed even after the API recovered.
Incident (BIT-32855)
HttpProbeFailed on http://10.10.50.63/ (pr_site, CT 266). Timeline:
pr-api (CT 264) was vzmigrated to node obelix and rebooted.
While pr-api was booting, pr-site's SSR fetch to API_URL=http://10.10.50.61:3000 failed -> Next.js returned 500.
No self-heal: PM2 was gone, so even after pr-api came back (health 200), pr-site stayed 502.
Fix
Bound wait_for by wall clock (BOOT_HEALTH_BUDGET_SEC, default 150s) so boot.sh always exits within TimeoutStartSec with margin for the pm2_start retry path. PM2 (autorestart) and the next-env watchdog handle real recovery; this poll only confirms the boot. On a clean exit the PM2 daemon survives (Type=oneshot, RemainAfterExit=yes).
Verification
bash -n infra/deploy/boot.sh (CI gate) passes.
Isolated wait_for unit tests: success path -> 0; budget timeout -> 1 within budget.
The deployed photoreport-boot.service on CT 266 (and 265/267) is stale: TimeoutStartSec=300, no Restart=on-failure. The repo unit (infra/systemd/photoreport-boot.service) is already ahead (420 + Restart=on-failure/RestartSec=30/StartLimitBurst=5). Updating the unit on the CTs is a host-ops action (agents never SSH into containers, docs/DEPLOY.md) -- DevOps/sysadmin to install the repo unit + systemctl daemon-reload on each pr-* container.
Paperclip-Issue: BIT-32855
## Why
`boot.sh` `wait_for` polled on a fixed try count (`HEALTH_TRIES=90`, ~450s worst case), which exceeded `photoreport-boot.service`'s `TimeoutStartSec`. When the API a container depends on was briefly down, `wait_for` never got 200, systemd timed the oneshot out, killed the whole cgroup — including the PM2 daemon boot.sh had just launched — and left nginx with no upstream (502) that never self-healed even after the API recovered.
## Incident (BIT-32855)
`HttpProbeFailed` on `http://10.10.50.63/` (pr_site, CT 266). Timeline:
1. pr-api (CT 264) was `vzmigrate`d to node `obelix` and rebooted.
2. While pr-api was booting, pr-site's SSR fetch to `API_URL=http://10.10.50.61:3000` failed -> Next.js returned 500.
3. `photoreport-boot.service` `wait_for` (count-based, ~450s) exceeded `TimeoutStartSec=300` (stale deployed unit) -> systemd killed the cgroup -> PM2 died -> nginx 502 -> blackbox probe failed.
4. No self-heal: PM2 was gone, so even after pr-api came back (health 200), pr-site stayed 502.
## Fix
Bound `wait_for` by wall clock (`BOOT_HEALTH_BUDGET_SEC`, default 150s) so `boot.sh` always exits within `TimeoutStartSec` with margin for the `pm2_start` retry path. PM2 (`autorestart`) and the next-env watchdog handle real recovery; this poll only confirms the boot. On a clean exit the PM2 daemon survives (`Type=oneshot`, `RemainAfterExit=yes`).
## Verification
- `bash -n infra/deploy/boot.sh` (CI gate) passes.
- Isolated `wait_for` unit tests: success path -> 0; budget timeout -> 1 within budget.
- Live: pr-site probe from blackbox CT 224 -> `200`; PM2 `photoreport-site` (2 instances) `online`, 0 restarts.
## Operational follow-up (not in this PR)
The deployed `photoreport-boot.service` on CT 266 (and 265/267) is stale: `TimeoutStartSec=300`, no `Restart=on-failure`. The repo unit (`infra/systemd/photoreport-boot.service`) is already ahead (`420` + `Restart=on-failure`/`RestartSec=30`/`StartLimitBurst=5`). Updating the unit on the CTs is a host-ops action (agents never SSH into containers, docs/DEPLOY.md) -- DevOps/sysadmin to install the repo unit + `systemctl daemon-reload` on each pr-* container.
Paperclip-Issue: BIT-32855
wait_for polled on a fixed try count (HEALTH_TRIES=90, ~450s worst case),
which exceeded photoreport-boot.service's TimeoutStartSec. When the API a
container depends on was briefly down (pr-api rebooting after a vzmigrate),
pr-site's wait_for never got 200, systemd timed the oneshot out, killed the
whole cgroup — including the PM2 daemon boot.sh had just launched — and left
nginx with no upstream (502) that never self-healed even after the API
recovered.
Bound wait_for by wall clock (BOOT_HEALTH_BUDGET_SEC, default 150s) so
boot.sh always exits within TimeoutStartSec with margin for the pm2_start
retry path. PM2 (autorestart) and the next-env watchdog handle real
recovery; this poll only confirms the boot.
Paperclip-Issue: BIT-32855
spark
merged commit 88e74d34ba into main2026-11-22 01:24:01 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Why
boot.shwait_forpolled on a fixed try count (HEALTH_TRIES=90, ~450s worst case), which exceededphotoreport-boot.service'sTimeoutStartSec. When the API a container depends on was briefly down,wait_fornever got 200, systemd timed the oneshot out, killed the whole cgroup — including the PM2 daemon boot.sh had just launched — and left nginx with no upstream (502) that never self-healed even after the API recovered.Incident (BIT-32855)
HttpProbeFailedonhttp://10.10.50.63/(pr_site, CT 266). Timeline:vzmigrated to nodeobelixand rebooted.API_URL=http://10.10.50.61:3000failed -> Next.js returned 500.photoreport-boot.servicewait_for(count-based, ~450s) exceededTimeoutStartSec=300(stale deployed unit) -> systemd killed the cgroup -> PM2 died -> nginx 502 -> blackbox probe failed.Fix
Bound
wait_forby wall clock (BOOT_HEALTH_BUDGET_SEC, default 150s) soboot.shalways exits withinTimeoutStartSecwith margin for thepm2_startretry path. PM2 (autorestart) and the next-env watchdog handle real recovery; this poll only confirms the boot. On a clean exit the PM2 daemon survives (Type=oneshot,RemainAfterExit=yes).Verification
bash -n infra/deploy/boot.sh(CI gate) passes.wait_forunit tests: success path -> 0; budget timeout -> 1 within budget.200; PM2photoreport-site(2 instances)online, 0 restarts.Operational follow-up (not in this PR)
The deployed
photoreport-boot.serviceon CT 266 (and 265/267) is stale:TimeoutStartSec=300, noRestart=on-failure. The repo unit (infra/systemd/photoreport-boot.service) is already ahead (420+Restart=on-failure/RestartSec=30/StartLimitBurst=5). Updating the unit on the CTs is a host-ops action (agents never SSH into containers, docs/DEPLOY.md) -- DevOps/sysadmin to install the repo unit +systemctl daemon-reloadon each pr-* container.Paperclip-Issue: BIT-32855