From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
---|---|
To: | Joel Jacobson <joel(at)compiler(dot)org> |
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 02:26:37 |
Message-ID: | 52CC167F-763B-4ECA-B0B4-DAB381816828@gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> On Sep 26, 2025, at 05:13, Joel Jacobson <joel(at)compiler(dot)org> wrote:
>
> Hmm, I don't see how duplicate timeout could happen?
>
> Once we decide to defer the wakeup, wakeup_pending_flag remains set,
> which avoids further signals from notifiers, so I don't see how we could
> re-enter ProcessIncomingNotify(), since notifyInterruptPending is reset
> when ProcessIncomingNotify() is called, and notifyInterruptPending is
> only set when a signal is received (or set directly when in same
> process).
>
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.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2025-09-26 02:28:48 | Re: [BUG] temporary file usage report with extended protocol and unnamed portals |
Previous Message | Richard Guo | 2025-09-26 02:26:16 | Re: plan shape work |