UNLISTEN bug - Mailing list pgsql-bugs

From Jeff Davis
Subject UNLISTEN bug
Date
Msg-id 1285139123.1897.46.camel@jdavis-laptop
Whole thread Raw
Responses Re: UNLISTEN bug
Re: UNLISTEN bug
List 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@postgresql.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

pgsql-bugs by date:

Previous
From: "Jairo Carrillo"
Date:
Subject: BUG #5671: ERROR: out of memory
Next
From: "Benjamin Gigot"
Date:
Subject: BUG #5672: Can't input julian days BC