Skip to content

Stop flapping alerts#1582

Open
dstathis wants to merge 2 commits into
canonical:mainfrom
dstathis:main
Open

Stop flapping alerts#1582
dstathis wants to merge 2 commits into
canonical:mainfrom
dstathis:main

Conversation

@dstathis

@dstathis dstathis commented Jun 10, 2026

Copy link
Copy Markdown

Issue

The Postgresql charm constantly has flapping alerts. I see these three regularly.

Solution

Only fire if the condition is detected for 5 minutes or more.

Checklist

  • I have added or updated any relevant documentation.
  • I have cleaned any remaining cloud resources from my accounts.

@dstathis
dstathis requested a review from a team as a code owner June 10, 2026 09:21
@dstathis
dstathis requested review from carlcsaposs-canonical, dragomirp, juju-charm-bot, marceloneppel and taurus-forever and removed request for a team June 10, 2026 09:21

@taurus-forever taurus-forever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dstathis thank you for the PR! Can you please share the root cause of the issue?

Are the problem in the real outage/lack of patroni leader OR alerts are really fake/noisy?
In the first case, we should fix the stability, in the second fix alerts.

I believe 5 minutes downtime is unacceptable slow/long for 99.999% uptime target.
Anyway, defaults here defined by @7annaba3l business use cases.

AFAIK, COS have a way to fine-tune defaults per deployment,
while charm should be safe with it's default => provide maximum uptime,
otherwise immediately alert about the outage.

@taurus-forever
taurus-forever requested a review from 7annaba3l June 10, 2026 09:56
@dstathis

Copy link
Copy Markdown
Author

I am not really sure if there is a real problem. I haven't noticed any issues with related apps. There do seem to be some error logs but I don't really know how to interpret them.

1781096239645	2026-06-10T12:57:19.645Z	2026-06-10 12:57:18 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=4.998069216962904)") 
1781096238903	2026-06-10T12:57:18.903Z	2026-06-10 12:57:18 UTC [533537]: user=relation_id_55,db=joplin_db,app=[unknown],client=10.42.0.112,line=9 ERROR:  25006: cannot execute UPDATE in a read-only transaction
1781096233882	2026-06-10T12:57:13.882Z	2026-06-10 12:57:13 UTC [28]: WARNING: Loop time exceeded, rescheduling immediately. 
1781096233388	2026-06-10T12:57:13.388Z	2026-06-10 12:57:13 UTC [533527]: user=,db=,app=,client=,line=3 WARNING:  01000: specified neither primary_conninfo nor restore_command
1781096231878	2026-06-10T12:57:11.878Z	2026-06-10 12:57:11 UTC [28]: ERROR: Error communicating with DCS 
1781096231878	2026-06-10T12:57:11.878Z	2026-06-10 12:57:11 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=1.6817180656362325)") 
1781096230375	2026-06-10T12:57:10.375Z	2026-06-10 12:57:09 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=2.2909465699922293)") 
1781096226866	2026-06-10T12:57:06.866Z	2026-06-10 12:57:06 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=4.999774653930217)") 
1781095920013	2026-06-10T12:52:00.013Z	2026-06-10 12:52:00 UTC [533395]: user=relation_id_55,db=joplin_db,app=[unknown],client=10.42.0.112,line=19 ERROR:  25006: cannot execute UPDATE in a read-only transaction
1781095920013	2026-06-10T12:52:00.013Z	2026-06-10 12:52:00 UTC [533395]: user=relation_id_55,db=joplin_db,app=[unknown],client=10.42.0.112,line=14 ERROR:  25006: cannot execute UPDATE in a read-only transaction
1781095918908	2026-06-10T12:51:58.908Z	2026-06-10 12:51:58 UTC [533395]: user=relation_id_55,db=joplin_db,app=[unknown],client=10.42.0.112,line=9 ERROR:  25006: cannot execute UPDATE in a read-only transaction
1781095918546	2026-06-10T12:51:58.546Z	2026-06-10 12:51:58 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=4.998133548069745)") 
1781095914035	2026-06-10T12:51:54.035Z	2026-06-10 12:51:53 UTC [28]: WARNING: Loop time exceeded, rescheduling immediately. 
1781095912893	2026-06-10T12:51:52.893Z	2026-06-10 12:51:52 UTC [533386]: user=,db=,app=,client=,line=3 WARNING:  01000: specified neither primary_conninfo nor restore_command
1781095912281	2026-06-10T12:51:52.281Z	2026-06-10 12:51:51 UTC [28]: ERROR: Error communicating with DCS 
1781095912281	2026-06-10T12:51:52.281Z	2026-06-10 12:51:51 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=1.6320672447327524)") 
1781095909275	2026-06-10T12:51:49.275Z	2026-06-10 12:51:49 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=2.4061025369446725)") 
1781095907271	2026-06-10T12:51:47.271Z	2026-06-10 12:51:46 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=4.999838114017621)") 
1781095601575	2026-06-10T12:46:41.575Z	2026-06-10 12:46:41 UTC [28]: WARNING: Loop time exceeded, rescheduling immediately. 
1781095599068	2026-06-10T12:46:39.068Z	2026-06-10 12:46:38 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=2.4351893060375005)") 
1781095597063	2026-06-10T12:46:37.063Z	2026-06-10 12:46:36 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=4.999821092002094)") 
1781095288727	2026-06-10T12:41:28.727Z	2026-06-10 12:41:28 UTC [533193]: user=relation_id_55,db=joplin_db,app=[unknown],client=10.42.0.112,line=49 ERROR:  25006: cannot execute UPDATE in a read-only transaction
1781095285472	2026-06-10T12:41:25.472Z	2026-06-10 12:41:24 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=4.997940392931923)") 
1781095280461	2026-06-10T12:41:20.461Z	2026-06-10 12:41:19 UTC [28]: WARNING: Loop time exceeded, rescheduling immediately. 
1781095280461	2026-06-10T12:41:20.461Z	2026-06-10 12:41:19 UTC [28]: ERROR: Error communicating with DCS 
1781095280461	2026-06-10T12:41:20.461Z	2026-06-10 12:41:19 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=1.3476252644322813)") 
1781095278670	2026-06-10T12:41:18.670Z	2026-06-10 12:41:18 UTC [533193]: user=relation_id_55,db=joplin_db,app=[unknown],client=10.42.0.112,line=44 ERROR:  25006: cannot execute UPDATE in a read-only transaction
1781095277704	2026-06-10T12:41:17.704Z	2026-06-10 12:41:17 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=2.309974636649713)") 
1781095275448	2026-06-10T12:41:15.448Z	2026-06-10 12:41:14 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=4.9982411719392985)") 
1781095270434	2026-06-10T12:41:10.434Z	2026-06-10 12:41:09 UTC [28]: WARNING: Loop time exceeded, rescheduling immediately. 
1781095270434	2026-06-10T12:41:10.434Z	2026-06-10 12:41:09 UTC [28]: ERROR: Error communicating with DCS 
1781095270434	2026-06-10T12:41:10.434Z	2026-06-10 12:41:09 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=1.965355455642566)") 
1781095268650	2026-06-10T12:41:08.650Z	2026-06-10 12:41:08 UTC [533193]: user=relation_id_55,db=joplin_db,app=[unknown],client=10.42.0.112,line=39 ERROR:  25006: cannot execute UPDATE in a read-only transaction
1781095267678	2026-06-10T12:41:07.678Z	2026-06-10 12:41:07 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=2.28794565028511)") 
1781095265422	2026-06-10T12:41:05.422Z	2026-06-10 12:41:04 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=4.9977402039803565)") 
1781095260402	2026-06-10T12:41:00.402Z	2026-06-10 12:40:59 UTC [28]: WARNING: Loop time exceeded, rescheduling immediately. 
1781095260402	2026-06-10T12:41:00.402Z	2026-06-10 12:40:59 UTC [28]: ERROR: Error communicating with DCS 
1781095260402	2026-06-10T12:41:00.402Z	2026-06-10 12:40:59 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=1.8613355313427746)") 
1781095260131	2026-06-10T12:41:00.131Z	2026-06-10 12:41:00 UTC [533193]: user=relation_id_55,db=joplin_db,app=[unknown],client=10.42.0.112,line=34 ERROR:  25006: cannot execute UPDATE in a read-only transaction
1781095260131	2026-06-10T12:41:00.131Z	2026-06-10 12:41:00 UTC [533193]: user=relation_id_55,db=joplin_db,app=[unknown],client=10.42.0.112,line=29 ERROR:  25006: cannot execute UPDATE in a read-only transaction
1781095258866	2026-06-10T12:40:58.866Z	2026-06-10 12:40:58 UTC [533193]: user=relation_id_55,db=joplin_db,app=[unknown],client=10.42.0.112,line=24 ERROR:  25006: cannot execute UPDATE in a read-only transaction
1781095257644	2026-06-10T12:40:57.644Z	2026-06-10 12:40:57 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=2.29505876544863)") 
1781095255388	2026-06-10T12:40:55.388Z	2026-06-10 12:40:54 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=4.997974877944216)") 
1781095250376	2026-06-10T12:40:50.376Z	2026-06-10 12:40:49 UTC [28]: WARNING: Loop time exceeded, rescheduling immediately. 
1781095250376	2026-06-10T12:40:50.376Z	2026-06-10 12:40:49 UTC [28]: ERROR: Error communicating with DCS 
1781095250376	2026-06-10T12:40:50.376Z	2026-06-10 12:40:49 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=1.5266079809516668)") 
1781095248837	2026-06-10T12:40:48.837Z	2026-06-10 12:40:48 UTC [533193]: user=relation_id_55,db=joplin_db,app=[unknown],client=10.42.0.112,line=19 ERROR:  25006: cannot execute UPDATE in a read-only transaction
1781095247620	2026-06-10T12:40:47.620Z	2026-06-10 12:40:47 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=2.2997376185376197)") 
1781095244862	2026-06-10T12:40:44.862Z	2026-06-10 12:40:44 UTC [28]: ERROR: Request to server https://10.43.0.1:443 failed: ReadTimeoutError("HTTPSConnectionPool(host='10.43.0.1', port=443): Read timed out. (read timeout=4.99819426308386)") 

@taurus-forever

taurus-forever commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Well... is it some unstable networking environment?

The ERROR: Error communicating with DCS means: Patroni has failed to reach K8s etcd (DCS storage used to store config and tick Primary flag for election). Patroni Primary might step down to avoid split-brain via expiration in DCS => alert for no Primary.

The message ERROR: 25006: cannot execute UPDATE in a read-only transaction also means cluster went into read-only mode (due to Primary step down?). It should be clearly visible in Patroni logs on Primary server.

Once K8s etcd/DCS is reachable again => the new Primary elected => all restored.

We will consider to bump 0m slightly, as it might be too agressive (@7annaba3l to provide a good value), but 5m is too high for sure. We should trace your DCS instabilities and either fix the origin OR fine tune timeouts to avoid the real Primary (writes) outages. It will fix alerts instead of muting them. WDYT? @dstathis

dstathis added 2 commits June 11, 2026 18:20
Increased alert duration for PatroniHasNoLeader from 0m to 5m.

Signed-off-by: Dylan Stephano-Shachter <dylan.stephano-shachter@canonical.com>
Signed-off-by: Dylan Stephano-Shachter <dylan.stephano-shachter@canonical.com>
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.

2 participants