Re: Fix memleaks and error handling in jsonb_plpython

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Fix memleaks and error handling in jsonb_plpython
Дата
Msg-id 20190308055911.GG4099@paquier.xyz
обсуждение исходный текст
Ответ на Re: Fix memleaks and error handling in jsonb_plpython  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: Fix memleaks and error handling in jsonb_plpython
Список pgsql-hackers
On Wed, Mar 06, 2019 at 11:04:23AM +0900, Michael Paquier wrote:
> Another thing is that you cannot just return within a try block with
> what is added in PLyObject_FromJsonbContainer, or the error stack is
> not reset properly.  So they should be replaced by breaks.

So, I have been poking at this stuff, and I am finishing with the
attached.  The origin of the issue comes from PLyObject_ToJsonbValue()
and PLyObject_FromJsonbValue() which could result in problems when
working on PyObject which it may allocate.  So this has resulted in
more refactoring of the code than I expected first.  I also decided to
not keep the additional errors which have been added in the previous
version of the patch.  From my understanding of the code, these cannot
actually happen, so replacing them by assertions is enough in my
opinion.

While on it, I also noticed that hstore_plpython does not actually
need a volatile pointer for plpython_to_hstore().  Also, as all those
problems are really unlikely going to happen in real-life cases,
improving this code only on HEAD looks enough to me.
--
Michael

Вложения

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

Предыдущее
От: Masahiko Sawada
Дата:
Сообщение: Re: New vacuum option to do only freezing
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Small doc fix for pageinspect