Skip to content

fix(service): don't report READY before the endpoint accepts connections - #184

Draft
gonzaloserrano wants to merge 1 commit into
mainfrom
gsr/fix-service-create-readiness-probe
Draft

fix(service): don't report READY before the endpoint accepts connections#184
gonzaloserrano wants to merge 1 commit into
mainfrom
gsr/fix-service-create-readiness-probe

Conversation

@gonzaloserrano

@gonzaloserrano gonzaloserrano commented Aug 5, 2026

Copy link
Copy Markdown

service create waits on the control-plane status field, which flips to READY before Postgres binds its port. internal/common/ready.go already documents READY as "accepting connections". Callers connecting immediately get ECONNREFUSED.

Prod repro in timescale/migration-smoke-test (run 30977861902): READY 20.1s after create, refused 91ms later. Twice in 40 runs. start and fork share the pattern.

WaitForConnectable polls the endpoint after the status wait, capped at 2 minutes. Any Postgres protocol error counts as serving: 28P01 proves the server is up, just refusing our credentials, so no password is needed. 57P03 is the exception and keeps waiting.

Best-effort: unverifiable endpoints warn rather than fail; a VPC-only service is healthy but unreachable from here.

For review: do start/fork belong here, and should the budget be a flag? Call sites covered only by compilation (create tests use --no-wait).

service create/start/fork waited only on the control-plane status field,
which flips to READY before Postgres binds its port. ready.go already
documents READY as "accepting connections", so callers that connect
immediately raced it and got ECONNREFUSED.

Add WaitForConnectable, which probes the endpoint until it answers, and
run it after the status wait. Any Postgres protocol error counts as
serving so the probe works without credentials; 57P03 keeps waiting.
Best-effort: an unverified endpoint warns rather than failing, since a
VPC-only or allowlisted service is legitimately unreachable from the CLI
host while being healthy.
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.

1 participant