Re: Plpython crashing the backend in one easy step

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Plpython crashing the backend in one easy step
Дата
Msg-id 3753.1005688514@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Plpython crashing the backend in one easy step  (Bradley McLean <brad@bradm.net>)
Ответы Re: Plpython crashing the backend in one easy step  (Bradley McLean <brad@bradm.net>)
Re: Plpython crashing the backend in one easy step - fix  (Bradley McLean <brad@bradm.net>)
Re: Plpython crashing the backend in one easy step  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Bradley McLean <brad@bradm.net> writes:
> In Option (C), I set the global "InError" flag to false, and then
> return NULL, causing all of the error messages to come out and
> plpython to clean up gracefully, no backend crash.  However, this
> seems to be an unprecedented approach, and I could be missing
> something big.

Yes, as in "it's totally unsafe".  Suppressing an elog(ERROR) is 
a *big* no-no at present, because way too much stuff relies on
post-abort cleanup to clean up whatever problem is being reported.
You cannot allow the transaction to continue after the error, and
you most certainly mustn't cavalierly reset the error handling state.

The only things you should be doing with longjmp trapping are
(a) doing any cleanup that Python itself has to have before you
re-propagate the longjmp, or
(b) issuing elog(NOTICE) to help identify the error location
before you re-propagate the longjmp.

plpgsql contains an example of doing (b).

Not propagating the longjmp, which is what the code seems to be doing
at present, is not acceptable.  I had not looked at this code closely,
but as-is it is a huge reliability hazard.  I will insist on removing
plpython from 7.2 entirely if this can't be fixed before release.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pg locking problem
Следующее
От: Bradley McLean
Дата:
Сообщение: Re: Plpython crashing the backend in one easy step