Skip to content

fix(cli): exec remaining start wrappers so docker stop is not 10s (CLI-2192) - #6203

Merged
avallete merged 3 commits into
developfrom
avallete/fast-stop-exec-wrappers
Aug 25, 2026
Merged

fix(cli): exec remaining start wrappers so docker stop is not 10s (CLI-2192)#6203
avallete merged 3 commits into
developfrom
avallete/fast-stop-exec-wrappers

Conversation

@avallete

@avalleteavallete commented Aug 14, 2026

Copy link
Copy Markdown
Member

supabase stop --no-backup was gated by Docker's 10s SIGTERM grace: Kong, Vector, Edge Runtime, and Logflare kept sh as PID 1 (or hung in their own shutdown), and stops run in parallel so wall time = slowest container.

Postgres exec and postgres-meta v0.98.0 already landed on develop with #6184 / #6207. This PR is only the remaining wrappers, rebased onto that tip.

What changed

exec in every remaining CLI-authored wrapper so the real process is PID 1 (deliberate divergence from Go; stop timing is outside the parity surface, ADR 0016). Command paths, output, exit codes, telemetry, and documented side effects unchanged; no -t, no docker rm -f, no grace-period env:

  • Kong
  • Vector — wget wait-loop kept; TERM during that wait now exits instead of burning the 10s grace
  • Edge Runtime — long-lived start / functions serve container and the ephemeral script-runner

supabase stop --no-backup wall time

CLIrun 1run 2run 3minavgmax
@beta 2.116.0-beta.612.665s12.743s12.502s12.502s12.64s12.743s
PR 6203 @ 28c39f14.918s4.885s5.623s4.885s5.14s5.623s

~2.5× faster (avg −7.5s / −59%). Start time is unchanged (same ~30–45s after images are warm).

Per-container docker stop -t 10

ContainerPID 1 @betaPID 1 PRStop @betaStop PR
kongsh -cdocker-entrypoint.sh kong docker-startnginx: master process10.241s0.167s
vectorsh -cvector --configvector --config /etc/vector/vector.yaml10.478s0.288s
edge_runtimesh -c edge-runtime start …edge-runtime start …10.405s0.296s
analytics (logflare)sh -csh run.shsupervised sh run.sh (TERM → 3s → KILL)10.274s3.227s
dbpostgres (already exec)postgres (unchanged)0.571s3.4–4.5s (see below)
pg_metanode dist/server/server.jsnode dist/server/server.js0.257s0.297s

Stops run in parallel, so wall time ≈ slowest container + CLI prune (container prune → optional volume prune → network prune). @beta is gated by the ~10.4s wrappers. This PR is gated by Logflare’s ~3s supervisor and Postgres shutdown (~4s on a full local db), which matches the ~5s stop --no-backup times.

Options to gain more speed (defered)

Just levers. After this PR, wall time is ~max(logflare ≈ 3s, postgres ≈ 4s) + ~1s prune. Cutting only Logflare leaves Postgres as the gate (~4s + prune ≈ 5s, i.e. little visible win). Beating ~3s wall needs both plus less prune.

Logflare (~3s supervisor)

  1. Upstream: image whose SIGTERM handler actually finishes (already tracked as the remaining nicety on CLI-2192). Then the 3s window can win without KILL.
  2. Shorter supervisor grace (3s → 1s). Same TERM-then-KILL shape, ~2s less. More likely to KILL a BEAM that would have exited at 2.5s.
  3. KILL immediately on TERM. Same end state as today’s post-timeout kill, ~3s sooner. Least graceful.

Postgres (~4s smart shutdown)

  1. Fast shutdown — trap SIGTERM and pg_ctl stop -m fast / SIGINT. Drops the wait-for-clients phase; still checkpoints. Helps most when Auth/REST/Realtime/Storage are still connected.
  2. Immediate shutdown-m immediate / SIGQUIT. Skips checkpoint; next start crash-recovers. Reasonable for stop --no-backup (volumes die anyway); bad if the volume is kept (stop without --no-backup).

@avallete
avallete requested a review from a team as a code ownerAugust 14, 2026 18:11
@avalleteavallete changed the title fix(cli): exec start wrappers and bump postgres-meta so docker stop is not 10sfix(cli): exec start wrappers and bump postgres-meta so docker stop is not 10s (CLI-2192)Aug 14, 2026
@github-actions

github-actionsBot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Supabase CLI preview

npx --yes https://pkg.pr.new/supabase/cli/supabase@aba42e87ae03d6887a4180a19fec965c1d10f3d0

Preview package for commit aba42e8.

@avallete
avalleteforce-pushed the avallete/fast-stop-exec-wrappers branch from 2383507 to 6c58a71CompareAugust 15, 2026 08:26
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@avallete
avalleteforce-pushed the avallete/fast-stop-exec-wrappers branch from 6c58a71 to 4d6fac4CompareAugust 15, 2026 09:06
@avallete
avallete changed the base branch from develop to avallete/shadow-db-perf-6ad622August 15, 2026 09:08
@chatgpt-codex-connector

This comment was marked as resolved.

@avallete
avalleteforce-pushed the avallete/fast-stop-exec-wrappers branch from 4d6fac4 to 7e0315cCompareAugust 15, 2026 09:58
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@avallete
avalleteforce-pushed the avallete/fast-stop-exec-wrappers branch from 7e0315c to 787493fCompareAugust 15, 2026 12:58
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

Base automatically changed from avallete/shadow-db-perf-6ad622 to developAugust 24, 2026 14:48
@avallete
avalleteforce-pushed the avallete/fast-stop-exec-wrappers branch from 27d1566 to a39916fCompareAugust 24, 2026 15:22
@avalleteavallete changed the title fix(cli): exec start wrappers and bump postgres-meta so docker stop is not 10s (CLI-2192)fix(cli): exec remaining start wrappers so docker stop is not 10s (CLI-2192)Aug 24, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@avallete

Copy link
Copy Markdown
MemberAuthor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit:ab08538a43

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

avalleteand others added 3 commits August 25, 2026 10:26
Postgres exec and postgres-meta v0.98.0 already landed with the shadow cache.
Keep Kong, Vector, Edge Runtime, and a Logflare TERM-then-KILL supervisor so
sh is no longer PID 1 on supabase stop. Vector's wait-loop now exits on TERM
instead of burning the grace period while Logflare is still down.
BusyBox ash defers TERM until the foreground probe finishes. Cap each
wget at 2s so a hung Logflare health endpoint cannot eat Docker's grace
period. Drop leftover Go-parity comment framing.
Same fast-stop fix as the legacy wrappers: exec vector so it is PID 1
and docker stop reaches it directly instead of burning the 10s grace
on the sh wrapper. No TERM trap needed here — the stack wrapper has no
health wait-loop; readiness is handled via service dependencies.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@avallete
avalleteforce-pushed the avallete/fast-stop-exec-wrappers branch from 28c39f1 to aba42e8CompareAugust 25, 2026 08:26

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:aba42e87ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@avallete
avallete added this pull request to the merge queueAug 25, 2026
@github-merge-queue
github-merge-queueBot removed this pull request from the merge queue due to failed status checks Aug 25, 2026
@avallete
avallete added this pull request to the merge queueAug 25, 2026
Merged via the queue into develop with commit 81937a2Aug 25, 2026
24 checks passed
@avallete
avallete deleted the avallete/fast-stop-exec-wrappers branch August 25, 2026 09:14
avallete added a commit that referenced this pull request Aug 25, 2026
…an shadows
Overlap the two next-engine plan shadows when a baseline can be shared, and keep
progress lines ordered. Rebased onto develop after #6102/#6184/#6203 landed.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@avallete@jgoux