Re: quickdie doing memory allocations (was atomic pin/unpin causing errors)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: quickdie doing memory allocations (was atomic pin/unpin causing errors)
Дата
Msg-id 10749.1462478205@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: quickdie doing memory allocations (was atomic pin/unpin causing errors)  (Andres Freund <andres@anarazel.de>)
Ответы Re: quickdie doing memory allocations (was atomic pin/unpin causing errors)  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
>> #0  0x00000008014321d7 in sbrk () from /lib/libc.so.7
>> #1  0x0000000801431ddd in sbrk () from /lib/libc.so.7
>> #2  0x000000080142e5bb in sbrk () from /lib/libc.so.7
>> #3  0x000000080142e085 in sbrk () from /lib/libc.so.7
>> #4  0x000000080142de28 in sbrk () from /lib/libc.so.7
>> #5  0x000000080142e1cf in sbrk () from /lib/libc.so.7
>> #6  0x0000000801439815 in free () from /lib/libc.so.7
>> #7  0x000000080149e3d6 in nsdispatch () from /lib/libc.so.7
>> #8  0x00000008014a41c6 in __cxa_finalize () from /lib/libc.so.7
>> #9  0x000000080144525c in exit () from /lib/libc.so.7
>> #10 0x00000000008e1bc2 in quickdie (postgres_signal_arg=3) at postgres.c:2623
>> #11 <signal handler called>
>> #12 0x0000000801431847 in sbrk () from /lib/libc.so.7

> That looks like independent issue, namely that we're trigger memory
> allocations from a signal handler (see frames 12, 11, 10, 9). Presumably
> due to system registered atexit handlers.  I suspect we should be using
> _exit() here?  Tom?

I don't think that would improve matters.  In the first place, if we use
_exit() here that might encourage third-party extension authors to believe
they should use _exit(), which would be bad.  In the second place,
we don't know what it is we're skipping by not running atexit handlers,
and again that could be bad.  We don't like people trying to bypass our
on-exit code, why would anyone else?  In the third place, by the time we
get to the exit() call we've already exposed ourselves to a whole lot of
such hazards by running ereport() (including sending a message to the
client!).  In the fourth place, if we've received a quickdie interrupt,
it doesn't actually matter if the process crashes; we just want it to
quit ASAP.

So I'd say that this is just a cosmetic problem and that trying to fix
it is likely to make things worse.
        regards, tom lane



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Naming of new tsvector functions
Следующее
От: Andreas Seltenreich
Дата:
Сообщение: [sqlsmith] Failed assertion in parallel worker (ExecInitSubPlan)