Subject: Signal Handler Overwrites errno (or YACPP)
From: Jason Tishler <[email-masked]>
To: Cygwin <[email-masked]>
Date: Wed, 27 Dec 2000 11:59:00 -0500

On Fri, 10 Dec 1999 20:51:27 -0500, Chris Faylor wrote:
> I've checked in changes that seem to fix this.  It was an interesting
> problem.  read() was setting the EINTR errno but it was getting
> overwritten by a signal handler because I've changed the way signal
> handlers are called now.  Although, actually, I would not be surprised
> to hear that this cropped up with B20.1 one time in a thousand too.
> 
> So, now, in some situations, I save the errno for restoration when
> a signal handler returns.

I am observing the same behavior as above but with select() and a SIGCHLD
handler when PostgreSQL has multiple TCP/IP connections.  Unfortunately,
this causes PostgreSQL's postmaster to abort since it perceives that
select() has returned with an unexpected error.

At first, I (possibly erroneously) concluded that the problem was on
the PostgreSQL side and I "fixed" it by modifying the appropriate signal
handler (i.e., reaper()) to save and restore errno.  If interested, see
the following for details:

    http://www.postgresql.org/mhonarc/pgsql-ports/2000-12/msg00046.html

After some reflection over the holidays (i.e., pondering on how Cygwin
would implement POSIX signals and handlers using the Win32 API) and
searching of the archives, I am no longer sure now.

What is responsible for preserving the errno value during signal handler
execution?  Is it the system (e.g., Cygwin) or the application (e.g.,
PostgreSQL)?

I've started to read the relevant Cygwin code, but it is (understandably)
not the easiest portion to grok.  So, I've decided to punt until I
hopefully get some feedback on whether or not this is actually a Cygwin
problem.

Thanks,
Jason

-- 
Jason Tishler
Director, Software Engineering       Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corp.               Fax:   +1 (732) 264-8798
82 Bethany Road, Suite 7             Email: [email-masked]
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple