Re: atexit_callback can be a net negative

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: atexit_callback can be a net negative
Дата
Msg-id 14684.1394204234@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: atexit_callback can be a net negative  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Ответы Re: atexit_callback can be a net negative  (Florian Weimer <fweimer@redhat.com>)
Список pgsql-hackers
Heikki Linnakangas <hlinnakangas@vmware.com> writes:
> On 03/07/2014 04:23 PM, Florian Weimer wrote:
>> There's the PID reuse problem.  Forking twice (with a delay) could end
>> up with the same PID as MyProcPid.

> Not if the parent process is still running.

If the original parent backend is *not* still running, then running
atexit_callback in the grandchild is just as dangerous if not more so;
it could be clobbering shared-memory state belonging to some other
session that has recycled the same PGPROC.

I think Florian's right that there's a risk there, but it seems pretty
remote, and I don't see any reliable way to detect the case anyhow.
(Process start time?  Where would you get that from portably?)
It's not a reason not to do something about the much larger chance of
this happening in a direct child process, which certainly won't have a
matching PID.
        regards, tom lane



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: atexit_callback can be a net negative
Следующее
От: Florian Weimer
Дата:
Сообщение: Re: atexit_callback can be a net negative