Repository navigation
Description
Is there an existing issue already for this bug?
- I have searched for an existing issue, and could not find anything. I believe this is a new bug.
I have read the troubleshooting guide
- I have read the troubleshooting guide and I think this is a new bug.
I am running a supported version of CloudNativePG
- I have read the troubleshooting guide and I think this is a new bug.
Contact Details
Version
1.28 (latest patch)
What version of Kubernetes are you using?
1.34
What is your Kubernetes environment?
Cloud: Amazon EKS
How did you install the operator?
Helm
What happened?
Summary
We ran into this in production. An AWS EBS performance degradation event in us-east-1 wedged the data volume on a CNPG v1.28.0 primary: COMMITs hung at XLogFlush, replicas stopped receiving WAL, and the postmaster stayed alive. The operator did not initiate failover for hours after writes stopped completing. We had to manually destroy the primary to initiate the failover.
We managed to reproduce the operator-side behavior on a dev EKS cluster running the same CNPG version and image catalog as production, using AWS FIS aws:ebs:pause-volume-io against the primary's data EBS volume.
Two independent pauses, both reliably:
- Blocked every client
COMMITfor the full pause window. - Left the Cluster CR
.statusand the operator's view completely unchanged.Ready=Truedid not flip, no failover, no log lines for the affected cluster at default verbosity.
The cluster setup is as follows:
- 3 instances (1 primary, 2 replicas), no
.spec.probes.liveness.type, nolivenessProbeTimeout,failoverDelay: 0.
Lab observation
The finding (the operator does not act on a write-path stall under default config) is reproduced deterministically in seconds with the following setup:
Same cluster config as above, single-row INSERT loop with wall-clock timestamps around each statement, FIS aws:ebs:pause-volume-io targeting the primary's EBS volume ARN.
We have observed the same identical behavior multiple times:
- The
INSERTin flight at pause-start printedstartand blocked. Itsdoneprinted within 1 s of the pause ending. Hang duration matched the pause window. NoINSERTcompleted inside the window. - Cluster CR
.status:currentPrimary == targetPrimarythroughout,instancesStatus.healthylisted all 3 pods,Ready=TruewithlastTransitionTimeunchanged from the previous value,phase: "Cluster in healthy state". - Operator logs at default verbosity: zero lines mentioning this cluster's namespace during either window. Other clusters continued to generate reconcile chatter, so the operator was alive and processing work.
What this confirms: the operator's view of cluster health is fully decoupled from the primary's ability to serve writes. A primary that cannot complete any COMMIT is, to the operator, indistinguishable from a healthy primary.
Why we believe this happens (v1.28.0 source)
/pg/status is served by remote.go calling (*Instance).GetStatus().
On a primary the SQL touched is:
pg_is_in_recovery()/pg_control_system()/ pending-restartpg_walfile_name(pg_current_wal_lsn())/pg_control_checkpoint()pg_replication_slots,pg_stat_replication
None dirty a buffer, write WAL, or flush. They read shared memory (pg_control_*, the WAL-sender ring, ProcArray) and catalog tables that are typically cached. So while user COMMITs block at issue_xlog_fsync, these queries return promptly with sensible values. pg_stat_replication rows continue to appear but with stale LSNs; GetStatus() does not record a timestamp against currentLsn, so a frozen LSN across many polls is not detectable from the payload alone.
The kubelet liveness probe is not a backstop either: at v1.28.0 livenessExecutor.IsHealthy on a primary returns OK whenever the API server is reachable; it issues no SQL. The streaming liveness type (streaming.go) short-circuits on NOT pg_is_in_recovery(). IsolationCheck only verifies external reachability.
What we would like to see (other suggestions welcome)
- Write-aware probe. A rate-limited tiny operation in
/pg/statusthat exercises the WAL flush path; fail if it doesn't complete in a configurable budget. Specific mechanism up to maintainers. - Per-poll LSN-advance check on the operator side.
GetStatus()already returnscurrentLsn. If it does not advance across K consecutive polls while connections > N, flag suspect. Pure observation, no extra writes.
Cluster resource
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
dosubot commentedon May 12, 2026
Hi @Robert-Manolea! I'm Dosu and I’m helping the cloudnative-pg team.
Thank you for this thorough and well-researched report. Your analysis of the code paths is correct — the status endpoint and liveness probes exercise only read-only queries and connectivity checks, so a primary with a wedged write path (stuck at
XLogFlush) remains invisible to the operator.This is a confirmed gap, and you're not the first to hit it in production. There are closely related issues tracking similar failure modes:
AreWalReceiversDownfailover gate for ~45 minutes [1].phase: "Cluster in healthy state"andreadyInstances: 3— the same class of problem whereIsWALReceiverActive()is collected but only consumed during promotion/switchover, not for ongoing health monitoring [2].received_lsnacross reconciliation cycles to distinguish keepalive-only traffic from actual WAL flow, but notes that no LSN history is currently persisted across reconcile loops [3].Your two proposals align well with what the community has discussed:
pg_isready,PingContext()) and isolation detection, never actual write/flush capability [4].currentLsnis indeed already returned byGetStatus(), but the operator collects it fresh each cycle with no historical comparison infrastructure in place [3].Additionally, the failover gates (
AreWalReceiversDowninreplicas.go,waitForWalReceiverDownin the instance controller) use effectively infinite polling loops with no timeout or staleness escalation — a separate but compounding factor in your scenario [1].Recent PRs (#10445, #10509) improved handling of transient
/pg/statusfailures (network blips), but do not address the case where the endpoint succeeds with stale data because the underlying queries don't touch the write path [5] [6].In short: this is a real and reproducible gap across multiple production environments, with no current workaround within the operator itself. Your FIS reproduction is a clean demonstration of it.
To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
ardentperf commentedon May 28, 2026
I think there could be some other benefits to having some kind of write heartbeat. I think might be worth starting a discussion for the general topic. It can also help ensure that WAL files rotate and get archived.
ardentperf commentedon Jun 24, 2026
caveat to above comment though - idk if we'd want to automatically trigger failover on write path failures. for example, a fairly obvious case would be where sync replication is configured (which it should be) and writes are stalled because there's no healthy replica. in this case, the primary is perfectly healthy and the replicas are the problem - we probably don't want a failover.
github-actions commentedon Aug 24, 2026
This issue is stale because it has been open for 60 days with no activity.
github-actions commentedon Oct 11, 2026
This issue was closed because it has been inactive for 14 days since being marked as stale.