This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Signal Handler Overwrites errno (or YACPP)


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: Jason.Tishler@dothill.com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]