From: | "Joel Jacobson" <joel(at)compiler(dot)org> |
---|---|
To: | "Chao Li" <li(dot)evan(dot)chao(at)gmail(dot)com> |
Cc: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Thomas Munro" <thomas(dot)munro(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, "Heikki Linnakangas" <hlinnaka(at)iki(dot)fi>, "Rishu Bagga" <rishu(dot)postgres(at)gmail(dot)com> |
Subject: | Re: Optimize LISTEN/NOTIFY |
Date: | 2025-09-26 09:32:29 |
Message-ID: | d35a114d-204a-4b40-9284-06749532b724@app.fastmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Sep 26, 2025, at 04:26, Chao Li wrote:
> I think what you explained is partially correct.
>
> Based on my understanding, any backend process may call
> SignalBackends(), which means that it’s possible that multiple backend
> processes may call SignalBackends() concurrently.
>
> Looking at your code, between checking
> QUEUE_BACKEND_WAKEUP_PENDING_FLAG(i) and set the flag to true, there is
> a block of code (the “if-else”) to run, so that it’s possible that
> multiple backend processes have passed the
> QUEUE_BACKEND_WAKEUP_PENDING_FLAG(i) check, then multiple signals will
> be sent to a process, which will lead to duplicate timeout enabled in
> the receiver process.
I don't see how that can happen; we're checking wakeup_pending_flag
while holding an exclusive lock, so I don't see how multiple backend
processes could be within the region where we check/set
wakeup_pending_flag, at the same time?
/Joel
From | Date | Subject | |
---|---|---|---|
Next Message | Ashutosh Bapat | 2025-09-26 09:41:00 | Re: POC: enable logical decoding when wal_level = 'replica' without a server restart |
Previous Message | Arseniy Mukhin | 2025-09-26 08:58:34 | Re: GIN tries to form a tuple with a partial compressedList during insertion |