Re: Trouble with PQnotifies()

Поиск
Список
Период
Сортировка
От Mark Morgan Lloyd
Тема Re: Trouble with PQnotifies()
Дата
Msg-id kaevl6$8ao$1@pye-srv-01.telemetry.co.uk
обсуждение исходный текст
Ответ на Re: Trouble with PQnotifies()  (seiliki@so-net.net.tw)
Список pgsql-general
seiliki@so-net.net.tw wrote:
>> The following listening worker thread behaves as expected if I insert/delete rows into/from table "t1" in psql
prompt.
>>
>> My trouble is when the SQL execution worker thread inserts/ deletes rows into/from table "t1", the listening worker
threadthen goes crazy: PQnotifies() always returns NULL which pushes the listening thread to grab all CPU power because
select()returns immediately in every iteration. The weird part is that select() says that there is something available
butPQnotifies() returns NULL. 
..
> Please ignore this question!
>
> My connection pool implementation seems to have flaw. Somehow and somewhere the connection acquired by a thread is
robbedby other threads. The PGconn  sending "LISTEN NotifyMe" becomes different from the PGconn passed to PQsocket(),
PQconsumeInput(),and/or PQnotifies(). 

I was looking at it carefully, and was about to ask about the
connection- in particular whether it was shared across threads etc. Glad
you've found the issue, I've been caught by something very similar using
list/notify on Lazarus/FPC where you can end up with several handles
only one of which is reliable.

> Please also pardon me for asking inappropriate questions like this one. As far as I can recall, every issue I
encounteredbefore always finally proved that PostgreSQL is flawless. 

But at least it demonstrates that somebody's using that facility.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]


В списке pgsql-general по дате отправления:

Предыдущее
От: seiliki@so-net.net.tw
Дата:
Сообщение: Re: Trouble with PQnotifies()
Следующее
От: David Noel
Дата:
Сообщение: Re: initdb error