Skip to content

fix: fail liveness probe when replication heartbeat is stale#25

Merged
Imtiaz246 merged 1 commit into
masterfrom
fix/liveness-heartbeat-stale
Jun 17, 2026
Merged

fix: fail liveness probe when replication heartbeat is stale#25
Imtiaz246 merged 1 commit into
masterfrom
fix/liveness-heartbeat-stale

Conversation

@Imtiaz246

Copy link
Copy Markdown
Collaborator

The liveness probe only checked conn.IsClosed(), which reports an explicitly closed connection but not a network-dead one. On a Postgres primary failover, the replication connection to the old primary goes silently dead: the periodic heartbeat fails and flips isAlive to false (so /ready returns 500), but /healthz stayed green and k8s never restarted the pod. The pod then ran indefinitely pointing at the old primary.

Include isAlive in the liveness check so a stalled heartbeat fails /healthz, letting Kubernetes restart the pod and reconnect to the new primary through the Service.

The liveness probe only checked conn.IsClosed(), which reports an
explicitly closed connection but not a network-dead one. On a Postgres
primary failover, the replication connection to the old primary goes
silently dead: the periodic heartbeat fails and flips isAlive to false
(so /ready returns 500), but /healthz stayed green and k8s never
restarted the pod. The pod then ran indefinitely pointing at the old
primary.

Include isAlive in the liveness check so a stalled heartbeat fails
/healthz, letting Kubernetes restart the pod and reconnect to the new
primary through the Service.

Signed-off-by: Imtiaz Uddin <imtiaz@appscode.com>
@Imtiaz246 Imtiaz246 merged commit 5fd3ca4 into master Jun 17, 2026
4 checks passed
@kodiakhq kodiakhq Bot deleted the fix/liveness-heartbeat-stale branch June 17, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants