Re: Interrupting long external library calls

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: Interrupting long external library calls
Дата
Msg-id 4FB39389.7020803@enterprisedb.com
обсуждение исходный текст
Ответ на Re: Interrupting long external library calls  (Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>)
Ответы Re: Interrupting long external library calls  (Sandro Santilli <strk@keybit.net>)
Список pgsql-hackers
On 16.05.2012 14:30, Mark Cave-Ayland wrote:
> On 16/05/12 11:39, Heikki Linnakangas wrote:
>
>> However, if you're absolutely positively sure that the library function
>> can tolerate that, you can set "ImmediateInterruptOK = true" before
>> calling it. See e.g PGSemaphoreLock() on how that's done before starting
>> to sleep on a semapgore.
>
> Hi Heikki,
>
> Yes that appears to work fine on the surface - just testing now to
> determine what state everything is left in when queries are aborted
> prematurely.

You're unlikely to catch all problems just by testing. I wouldn't trust 
that it's safe unless the library authors specifically mentions that it 
is safe to longjump out of the function at any time. Note for example 
that if the library function calls back to palloc/pfree, then it's not 
safe, because interrupting those functions is not safe.

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


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

Предыдущее
От: Mark Cave-Ayland
Дата:
Сообщение: Re: Interrupting long external library calls
Следующее
От: Thomas Girault
Дата:
Сообщение: Avoiding execution of some functions by query rewriting