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

From: Douglas McNaught <doug(at)mcnaught(dot)org>
To: Dennis Jenkins <dennis(dot)jenkins(at)sbcglobal(dot)net>
Cc: postgresql listserv <pgsql-general(at)postgresql(dot)org>
Subject: Re: Function written in C, hangs on one machine and not another...
Date: 2005-10-28 16:57:29
Message-ID: m2k6fxinpi.fsf@Douglas-McNaughts-Powerbook.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout <kleptog(at)svana(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Claire McLister 2005-10-28 17:45:48 Re: [Freegis-list] Re: [GENERAL] Map of Postgresql Users (OT)
Previous Message Martijn van Oosterhout 2005-10-28 16:36:56 Re: Function written in C, hangs on one machine and not another...