SIGTERM -> elog(FATAL) -> proc_exit() is probably a bad idea

Поиск
Список
Период
Сортировка
От Tom Lane
Тема SIGTERM -> elog(FATAL) -> proc_exit() is probably a bad idea
Дата
Msg-id 21658.979336914@sss.pgh.pa.us
обсуждение исходный текст
Ответы RE: SIGTERM -> elog(FATAL) -> proc_exit() is probably a bad idea  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
Список pgsql-hackers
I have just finished trudging through a bunch of code and trying to make
it secure against being interrupted by die() at arbitrary instants.
However, I am under no illusion that I have succeeded in making the
world safe for SIGTERM, and you shouldn't be either.  There is just way
too much code that is potentially invoked during proc_exit; even if we
fixed every line of our code, there's C library code that's not under
our control.  For example, malloc/free are not interrupt-safe on many
platforms, last I heard.  Do you want to put START/END_CRIT_SECTION
around every memory allocation operation?  I don't.

I think we'd be lots better off to abandon the notion that we can exit
directly from the SIGTERM interrupt handler, and instead treat SIGTERM
the same way we treat QueryCancel: set a flag that is inspected at
specific places where we know we are in a good state.

Comments?
        regards, tom lane


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

Предыдущее
От: ncm@zembu.com (Nathan Myers)
Дата:
Сообщение: Re: CRCs
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: CVS updates on committers list...