{"record":{"id":"6f2c9696ead31e58","repo":"neondatabase/neon","slug":"failed-to-get-list-of-walsenders","errorCode":null,"errorMessage":"failed to get list of walsenders: {}","messagePattern":"failed to get list of walsenders: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compute_tools/src/monitor.rs","lineNumber":291,"sourceCode":"        // N.B. walproposer doesn't currently show up in pg_stat_replication,\n        // but protect if it will.\n        const WS_COUNT_QUERY: &str =\n            \"select count(*) from pg_stat_replication where application_name != 'walproposer';\";\n        match cli.query_one(WS_COUNT_QUERY, &[]) {\n            Ok(r) => match r.try_get::<&str, i64>(\"count\") {\n                Ok(num_ws) => {\n                    if num_ws > 0 {\n                        self.last_active = Some(Utc::now());\n                        return Ok(());\n                    }\n                }\n                Err(e) => {\n                    let err: anyhow::Error = e.into();\n                    return Err(err.context(\"failed to parse walsenders count\"));\n                }\n            },\n            Err(e) => {\n                return Err(anyhow::anyhow!(\"failed to get list of walsenders: {}\", e));\n            }\n        }\n\n        // Don't suspend compute if there is an active logical replication subscription\n        //\n        // `where pid is not null` – to filter out read only computes and subscription on branches\n        const LOGICAL_SUBSCRIPTIONS_QUERY: &str =\n            \"select count(*) from pg_stat_subscription where pid is not null;\";\n        match cli.query_one(LOGICAL_SUBSCRIPTIONS_QUERY, &[]) {\n            Ok(row) => match row.try_get::<&str, i64>(\"count\") {\n                Ok(num_subscribers) => {\n                    if num_subscribers > 0 {\n                        self.last_active = Some(Utc::now());\n                        return Ok(());\n                    }\n                }\n                Err(e) => {\n                    return Err(anyhow::anyhow!(","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/neondatabase/neon/blob/8f60b04da47ffefe0e52bda2440134b42874eb75/compute_tools/src/monitor.rs#L273-L309","documentation":"check() runs `select count(*) from pg_stat_replication where application_name != 'walproposer'` to keep the compute from being suspended while (logical) walsenders are attached. This specific error fires when cli.query_one() itself fails; the column-conversion failure is a separate error ('failed to parse walsenders count'). On failure the monitor reports downtime and reconnects, same as other check() errors.","triggerScenarios":"query_one on pg_stat_replication returns Err: dropped connection, statement timeout, server restart, or the view being inaccessible during recovery transitions.","commonSituations":"Logical replication subscribers connected when the monitor connection breaks; computes with walproposer activity being polled during suspension handoff; transient errors during Postgres shutdown sequences.","solutions":["Read the nested error to distinguish connection loss from timeout","Rely on the monitor's built-in reconnect: single failures are logged and retried every 500ms","If persistent, verify Postgres health and pg_stat_replication is queryable as cloud_admin","When using logical replication, expect walsender counts to keep computes awake - plan monitor logs accordingly"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match cli.query_one(WS_COUNT_QUERY, &[]) {\n    Ok(r) => { let n: i64 = r.get(\"count\"); /* keep alive if n > 0 */ }\n    Err(e) => { error!(\"failed to get list of walsenders: {e}\"); client = conf.connect(NoTls); }\n}","preventionTips":["When using logical replication, plan for walsender-driven wakeups and stable monitor connections","Retry transient query failures on the next monitor tick instead of aborting","Reproduce with the cloud_admin role before escalating"],"tags":["postgres","pg-stat-replication","walsender","logical-replication","rust"],"backgroundTag":"postgres-query-failed","analyzedSha":"8f60b04da47ffefe0e52bda2440134b42874eb75","analyzedAt":"2026-08-16T23:39:28.135Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}