Repository navigation
fix: watchdog DNS tolerance + pg_isready in wait-service - #4
Merged
Merged
Conversation
…wait-service Watchdog was too aggressive — single nslookup failure (transient CoreDNS hiccup, network blip) triggered tunnel kill and unnecessary re-provisioning. Now requires 3 consecutive DNS failures before killing the tunnel. wait-service was checking only TCP port 5432 (nc -z), not PostgreSQL readiness. PostgreSQL from snapshot needs WAL recovery time — TCP port opens before PostgreSQL accepts connections. Now uses pg_isready to wait for actual PostgreSQL readiness, not just TCP port.
This was referenced Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two issues found after PR #3 (retry-loop re-provisioning):
1. Watchdog too aggressive (false positive re-provisioning)
Watchdog checked
nslookupevery 10s and killed the tunnel on first DNS failure. Butnslookupcan transiently fail (CoreDNS restart, network blip, DNS cache miss) even when the upstream workflow is alive. This caused unnecessary re-provisioning — client didn't crash, but watchdog killed the tunnel and ordered a new DB.Fix: Require 3 consecutive DNS failures before killing the tunnel (30s of continuous DNS failure = real deletion, not transient).
2. wait-service checks TCP port, not PostgreSQL readiness
wait-serviceusednc -z(TCP port check) — but PostgreSQL from snapshot needs WAL recovery time. TCP port 5432 opens before PostgreSQL accepts connections. Client connects, getswebsocket: close 1005for minutes until PostgreSQL is ready.Fix: Use
pg_isready(PostgreSQL-native readiness check) after TCP port is open. Changed image fromalpinetopostgres:17-alpine(haspg_isready).Testing