Re: [HACKERS] postmaster disappears

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] postmaster disappears
Date: 1999-09-21 13:59:59
Message-ID: 21449.937922399@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp> writes:
> In this case errno=ECHILD has been returned that makes postmaster
> exiting. This could happen if SIGCHLD raised between select() call and
> the next if (errno=...) statement. One of the solution would be
> ignoring ECHILD as well as EINTR. Included are patches for this.

Hmm. What you are saying, I guess, is that SIGCHLD is raised,
reaper() executes, and then when control continues in the main loop
the errno left over from reaper()'s last kernel call is what's seen,
instead of the one returned by signal().

Seems to me that the correct fix is to have reaper() save and restore
the outer value of errno, not to hack the main line to ignore the
most probable state left over from reaper(). Otherwise you still choke
if some other value gets returned from whatever call reaper() does last.
Moreover, you're not actually checking what the select() did unless
you do it that way.

Curious that this sort of problem is not seen more often --- I wonder
if most Unixes arrange to save/restore errno around a signal handler
for you?

regards, tom lane

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-09-21 14:01:40 Re: [HACKERS] Re: HISTORY for 6.5.2
Previous Message Tom Lane 1999-09-21 13:40:40 Re: [HACKERS] create table and default 'now' problem ?