exit() behavior on Windows? - Mailing list pgsql-hackers

From Tom Lane
Subject exit() behavior on Windows?
Date
Msg-id 12197.1463248291@sss.pgh.pa.us
Whole thread Raw
Responses Re: exit() behavior on Windows?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Rather belatedly, I've started to look into a fix for pg_dump's
problem with error reporting in parallel mode:
http://www.postgresql.org/message-id/2458.1450894615@sss.pgh.pa.us

One of the issues here is that pg_dump uses threads not subprocesses
to do parallelism on Windows, which means that totally different
reasoning is needed for that case.  I'm looking in particular at the
use of exit().  What I gather from Microsoft's documentation is that
exit() will kill the whole process not just the calling thread ---
can anyone confirm that that's correct?  Are the other threads just
killed asynchronously, or do they get a chance to shut down?

If it's just a quick kill, then there's a totally separate bug here for
Windows.  What is likely to happen with the current coding is that a
failing child thread will queue its error message into the communication
pipe, and then exit(1), thereby killing the whole pg_dump process before
the master thread can receive and print the error.  The visible result
would be about the same as what I described on Linux, ie failure exit
with no error message reported.  But the mechanism is different.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Perf Benchmarking and regression.
Next
From: Martín Marqués
Date:
Subject: Re: 10.0