UNLISTEN bug

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: UNLISTEN bug
Date: 2010-09-22 07:05:23
Message-ID: 1285139123.1897.46.camel@jdavis-laptop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

In honor of the very first bug report I sent to postgresql more than 10
years ago regarding UNLISTEN[1], I have decided to submit another
UNLISTEN bug (against HEAD):

Session1:

LISTEN foo;
BEGIN;
UNLISTEN foo;

Session2:

NOTIFY foo;

Session1:

SELECT 1;
COMMIT;
SELECT 1;

I seem to recall testing out similar situations during my review of this
patch, but I think the code has changed since that time.

The bug is pretty simple: ProcessIncomingNotify() is called in a tight
loop in EnableNotifyInterrupt() while notifyInterruptOccurred is true.
EnableNotifyInterrupt() is assuming that ProcessIncomingNotify() will
unset it, but it has an early return that's triggered by my UNLISTEN.

Simply adding an additional "notifyInterruptOccurred = 0" in the early
return path (patch attached) seems to work. I added it there rather than
moving the whole line up, because I wasn't sure if it's safe to do that
before DisableCatchupInterrupt().

Regards,
Jeff Davis

[1] http://www.mail-archive.com/pgsql-bugs(at)postgresql(dot)org/msg00225.html

Note: I couldn't even find that in our email archive, but thanks to our
new git repo, I found the commit fix by Bruce:

bdeeb4fe8ac22179eb0e12f16486e79c16090a2b

Attachment Content-Type Size
unlisten.patch text/x-patch 402 bytes

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Benjamin Gigot 2010-09-22 07:17:01 BUG #5672: Can't input julian days BC
Previous Message Alvaro Herrera 2010-09-21 21:50:57 Re: BUG #5669: server process was terminated by exception 0xC0000005