pgkill() is not POSIX-like for exiting processes - Mailing list pgsql-hackers

From Noah Misch
Subject pgkill() is not POSIX-like for exiting processes
Date
Msg-id 20140723012412.GA2403774@tornado.leadboat.com
Whole thread Raw
List pgsql-hackers
My new OpenLDAP test case has been breaking each MSVC buildfarm member.  Most
MinGW members are fine, though the 9.0 and 9.1 narwhal members broke.  (Newer
narwhal members have been broken long-term.)  The MSVC build system has a
mundane inability to handle a Makefile construct I used; the first attached
patch fixes that.  With that fixed, though, the test case reveals a departure
from POSIX in pgkill(), our emulation of kill(2) for Windows.  A pgkill() call
falling very close in time to process exit can easily give ERROR_BROKEN_PIPE,
and I at least once observed it give ERROR_BAD_PIPE.  pgkill() translates
those codes to EINVAL.  Only a buggy POSIX program will ever see EINVAL from
kill(2).  This situation is just like signalling a zombie, and POSIX kill(2)
returns zero for zombies.  Let's do that, as attached.

I'm inclined to back-patch this, although a quick scan didn't turn up any code
having bugs today as a result.  The change will affect occasional error
messages.  (An alternative is to change the test case code in the back
branches to treat EINVAL like success.)

On my systems, MSVC builds get ERROR_BROKEN_PIPE far more easily than MinGW
builds.  In MinGW, I ran "make -C contrib/dblink check" many times without
ever hitting the error, but "vcregress contribcheck" hit it over 99% of the
time.  I don't have a theory to explain that.

Thanks,
nm

--
Noah Misch
EnterpriseDB                                 http://www.enterprisedb.com

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Stating the significance of Lehman & Yao in the nbtree README
Next
From: Craig Ringer
Date:
Subject: Re: Shared Data Structure b/w clients