| From: | shihao zhong <zhong950419(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, joel(at)compiler(dot)org, arseniy(dot)mukhin(dot)dev(at)gmail(dot)com |
| Subject: | [PG19] A canceled notify read leaves the NOTIFY queue stuck |
| Date: | 2026-10-18 04:39:13 |
| Message-ID: | CAGRkXqQ1bmVwBw2CXiyZeWWP=XkHPXLPcQ7BSg2Q5JKSvDAnTA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
If a listener fails while taking its snapshot in
asyncQueueReadAllNotifications(), its isAdvancing flag stays set. After
that no NOTIFY wakes or advances it, so the queue stops shrinking and
fills up. This is new in 19, from 282b1cde9de.
A cancel while the listener waits for a safe snapshot is enough:
L listens, W holds a serializable transaction, N sends notifications
set default_transaction_isolation = serializable; -- L
set default_transaction_read_only = on; -- L
set default_transaction_deferrable = on; -- L
listen cfg; -- L
begin isolation level serializable; select 1; -- W
begin isolation level read committed read write not deferrable; -- L
notify cfg; -- N
commit; -- L, waits on SafeSnapshot, cancel it
rollback; -- W
select pg_notify('other', repeat('x', 7000)); -- N, 16 times
The attached patch clears the flag on abort.
This is the third low item in my list [1].
[1]
https://postgr.es/m/CAGRkXqSFdjqZP_kwRz7dv6LHX-CSrkDnynNXgntRsCEnQTKxmg@mail.gmail.com
Thanks,
Shihao
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Clear-isAdvancing-when-a-notify-read-is-aborted.patch | application/octet-stream | 1.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shihao zhong | 2026-10-18 04:39:40 | Re: BUG #19686: Rolling back SET TABLESPACE |
| Previous Message | Manu | 2026-10-18 04:32:10 | Re: json/jsonb cleanup + FmgrInfo caching |