X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-7.5 required=5.0 tests=AWL,BAYES_00,KHOP_PGP_SIGNED,KHOP_THREADED,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Message-ID: <50D4C879.4040505@dancol.org> Date: Fri, 21 Dec 2012 12:37:13 -0800 From: Daniel Colascione User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Intermittent failures retrieving process exit codes - snapshot test requested References: <50C2498C DOT 2000003 AT coverity DOT com> <50C276AC DOT 9090301 AT mailme DOT ath DOT cx> <50D401EF DOT 9040705 AT coverity DOT com> <20121221103241 DOT GD18188 AT calimero DOT vinschen DOT de> <20121221161024 DOT GA10871 AT ednor DOT casa DOT cgf DOT cx> <20121221170219 DOT GF18188 AT calimero DOT vinschen DOT de> <20121221193620 DOT GA29203 AT ednor DOT casa DOT cgf DOT cx> In-Reply-To: <20121221193620.GA29203@ednor.casa.cgf.cx> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig493F0E7BD45BC18B6C7AF291" X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --------------enig493F0E7BD45BC18B6C7AF291 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 12/21/2012 11:36 AM, Christopher Faylor wrote: > On Fri, Dec 21, 2012 at 06:02:19PM +0100, Corinna Vinschen wrote: >> On Dec 21 11:10, Christopher Faylor wrote: >>> On Fri, Dec 21, 2012 at 11:32:41AM +0100, Corinna Vinschen wrote: >>>> Maybe the signal thread should really not exit by itself, but just >>>> wait until the TerminateThread is called. Chris? >>> >>> If the analysis is correct, that just fixes one symptom doesn't it? >>> There are potentially many threads running in any Cygwin program >>> and it sounds like any one of them could trigger this. >> >> Right. I guess the question is how to synchronize things so that the >> thread calling TerminateProcess is actually the last one, making sure >> its return value is used. >> >> Maybe the NtQueryInformationThread(ThreadAmILastThread) call is of some >> help. Or we have to keep all thread IDs of the self-started threads >> available to terminate them explicitely at process exit. >=20 > I checked in a complicated fix for this problem which only affected > Cygwin-created threads. But, then, I thought about another riskier but > simpler fix.=20 Your second approach scares me. There's no global order imposed on the load= er lock and the Cygwin process lock, and Windows can take the loader lock at virtually any time, since LoadLibrary can be used internally to implement a= ny API. --------------enig493F0E7BD45BC18B6C7AF291 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (Cygwin) Comment: Using GnuPG with undefined - http://www.enigmail.net/ iEYEARECAAYFAlDUyHwACgkQ17c2LVA10VsjpwCg5c4Q1c7EsttXLogHPcKkoShq +00AnjhXM3Yp4+674znZjUGGzXIgIbOt =mKQN -----END PGP SIGNATURE----- --------------enig493F0E7BD45BC18B6C7AF291--