From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mirek Budzanowski <mirekb@tcs.uni.wroc.pl>
Cc: pgsql-sql@hub.org
Subject: Re: [SQL] notifying
Date: Thu, 27 May 1999 13:18:07 -0400
Message-ID: <22688.927825487@sss.pgh.pa.us> (raw)
In-Reply-To: <199905271353.PAA07490@pogwizd.ii.uni.wroc.pl>
Mirek Budzanowski <mirekb@tcs.uni.wroc.pl> writes:
> I got 2 proceses running on 2 different computers. One is Solaris
> 2.5.1 (a), the other HP-UX 10.20 (b). Postgres 6.4.2 ruuning on HP-UX.
> My proceses communicate with each other using postgres.
> They just do 'listen id', and the other send 'notify id'
> when is some data for the first.
> Both proceses wait on select() for notifies from the other.
Sounds fine --- my company's applications depend heavily on
LISTEN/NOTIFY, and it works perfectly reliably for us in 6.4.x.
(BTW, we are on HPUX too.)
> But after some time waiting on select() when i do from psql
> 'select * from pg_listener;' I get some strage result!
> Some times I get nothing, and some times only one proces!!
Not sure what is going on here. A LISTEN, once issued, is good for
the life of that backend (unless you UNLISTEN). I've never seen a
case of it getting dropped --- and our apps routinely run for weeks
and thousands of NOTIFY cycles.
The only thing I can think of offhand is that there are some
interactions between LISTEN/NOTIFY and transactions: if your app does
a LISTEN or a NOTIFY inside a transaction, the results will not be seen
elsewhere until you commit the transaction. Don't know if this applies
to your problem or not, but it's something to keep in mind when you use
NOTIFY.
I guess another obvious question is: are you sure you still have the
same backend as you originally issued the LISTEN to. PQreset(),
for example, kills the current backend and starts a new one. One
place this could be done without your realizing it is in a failed
COPY operation --- libpq uses PQreset() to recover if it loses sync
with the backend due to failure to follow the copy protocol...
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, mirekb@tcs.uni.wroc.pl, pgsql-sql@hub.org
Subject: Re: [SQL] notifying
In-Reply-To: <22688.927825487@sss.pgh.pa.us>
References: <199905271353.PAA07490@pogwizd.ii.uni.wroc.pl> <22688.927825487@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox