Skip to content

fix(cli): detect dead db connections (CLI-2207) - #6277

Open
7ttp wants to merge 1 commit into
developfrom
7ttp/cli-2207-supabase-db-resetstart-migration-apply-sql-pipeline-stops
Open

fix(cli): detect dead db connections (CLI-2207)#6277
7ttp wants to merge 1 commit into
developfrom
7ttp/cli-2207-supabase-db-resetstart-migration-apply-sql-pipeline-stops

Conversation

@7ttp

@7ttp 7ttp commented Aug 19, 2026

Copy link
Copy Markdown
Member

TL;DR

fixes supabase db reset and supabase start hanging forever with no error when the database connection dies while migrations are being applied

whats broken?

node-postgres silently discards every protocol frame once a socket stops being writable, while still reporting the write as successful, so the whole batch goes nowhere and the CLI waits forever on a reply the server was never asked for

it also leaves TCP keepalive off by default, where the Go CLI's driver had it on, so a peer that dies without a FIN or RST is never noticed either

fixed now by:

  • failing a batch that never reached the wire as a connection error, carrying the driver's own reason instead of blaming the migration's first statement
  • discarding that pooled connection, so the next batch redials instead of writing into the same dead socket
  • turning TCP keepalive on for every connection the CLI opens, so a silently dead peer is eventually detected instead of waited on

a server that stays alive but never answers still waits, matching the Go CLI, since that is indistinguishable from a long running statement

ref:

@7ttp 7ttp self-assigned this Aug 19, 2026
@7ttp
7ttp requested a review from a team as a code owner August 19, 2026 22:33
@github-actions

Copy link
Copy Markdown
Contributor

Supabase CLI preview

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

Preview package for commit 13bea16.

Sign up for free to 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.

supabase db reset/start: migration-apply SQL pipeline stops mid-stream with no server-side counterpart

1 participant