Re: Detecting libpq connections improperly shared via fork()

Поиск
Список
Период
Сортировка
Искать
От
Daniel Farina
Тема
Re: Detecting libpq connections improperly shared via fork()
Дата
Msg-id
CAAZKuFbwJNmjpceZyCizGtdOxRtdMNsBWjZAPy_scb1nUDNQvw@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Detecting libpq connections improperly shared via fork() Daniel Farina <daniel@heroku.com>
Re: Detecting libpq connections improperly shared via fork() Andres Freund <andres@2ndquadrant.com>
Re: Detecting libpq connections improperly shared via fork() Martijn van Oosterhout <kleptog@svana.org>
Re: Detecting libpq connections improperly shared via fork() Daniel Farina <daniel@heroku.com>
Re: Detecting libpq connections improperly shared via fork() Tom Lane <tgl@sss.pgh.pa.us>
Re: Detecting libpq connections improperly shared via fork() Andres Freund <andres@2ndquadrant.com>
Re: Detecting libpq connections improperly shared via fork() Daniel Farina <daniel@heroku.com>
Re: Detecting libpq connections improperly shared via fork() Andrew Dunstan <andrew@dunslane.net>
Re: Detecting libpq connections improperly shared via fork() Andres Freund <andres@2ndquadrant.com>
Re: Detecting libpq connections improperly shared via fork() Tom Lane <tgl@sss.pgh.pa.us>
Re: Detecting libpq connections improperly shared via fork() Daniel Farina <daniel@heroku.com>
On Wed, Oct 3, 2012 at 3:14 PM, Andres Freund  wrote:
> On Thursday, October 04, 2012 12:08:18 AM Daniel Farina wrote:
>> It would be fantastic for libpq to somehow monitor use of a connection
>> from multiple PIDs that share a parent and deliver an error indicating
>> what is wrong.  Unfortunately detecting that would require either a
>> file or some kind of shared memory map, AFAIK, and I don't know how
>> keen anyone is on accepting that patch.  So, may I ask: how keen is
>> anyone on accepting such a patch, and under what conditions of
>> mechanism?
> Hm. An easier version of this could just be storing the pid of the process
> that did the PQconnectdb* in the PGconn struct. You can then check that
> PGconn->pid == getpid() at relatively few places and error out on a mismatch.
> That should be doable with only minor overhead.

I suppose this might needlessly eliminate someone who forks and hands
off the PGconn struct to exactly one child, but it's hard to argue
with its simplicity and portability of mechanism.

-- 
fdr


В списке pgsql-hackers по дате отправления
От: Phil Sorber
Дата:
Сообщение: Re: PQping command line tool
От: Andres Freund
Дата:
FAQ