Re: Function written in C, hangs on one machine and not another...

Поиск
Список
Период
Сортировка
От Douglas McNaught
Тема Re: Function written in C, hangs on one machine and not another...
Дата
Msg-id m2k6fxinpi.fsf@Douglas-McNaughts-Powerbook.local
обсуждение исходный текст
Ответ на Re: Function written in C, hangs on one machine and not another...  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re: Function written in C, hangs on one machine and not another...  (CG <cgg007@yahoo.com>)
Список pgsql-general
Martijn van Oosterhout <kleptog@svana.org> writes:

> The things that have screwed me up in the past with pulling tricks like
> this are:
>
> 1. Program has registered atexit() handlers. _exit() avoids this.
> 2. Pending stdio output that gets flushed. The backend doesn't use
> stdio much so you might be fine here.
> 3. Signals. Make sure you don't get sent signals that screw state.
> Might be wise to block them all, or reset them all to default.
>
> Truly, exec() is the cleanest way to solve all this, it simply replaces
> the current process, lock, stock and barrel.

Definitely.  It would probably also be good to close all file
descriptors (except for stdin/etdout/stderr) before exec(), just in
case the other binary does something screwy with random file
descriptors (which it obviously shouldn't).

-Doug

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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Function written in C, hangs on one machine and not another...
Следующее
От: davidgn@servidor.unam.mx
Дата:
Сообщение: querying while copying into a table and optimizations