DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 5BGDBqxh4017522 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 5BGDBqxh4017522 X-Recipient: archive-cygwin AT delorie DOT com X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 155A24BA2E21 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 155A24BA2E21 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1765890691; cv=none; b=G5VEFvShUlkLcxN2+CezCAoLfxLiJ3GpvYYfvH7xNB5cIIhrzlElLbVt+hnC3U3izMu0cjPDr7TZcPBN2p7ePDdxkuxKaSL1I/f+NTqGbhPYqVjQLh99qkfWymq6iHQyJno5Ix2q9J+43ZeMtQeH136CFd1el9NRzM9P7Inq3Ao= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1765890691; c=relaxed/simple; bh=DtnASFmFJ9F4C6XJO9L1/+EG3t5zqIaYbuGiHneODdg=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=OxN9hNz4wwvnEFShmvlH2eXIiuvfP8qEhNZoCWvjoUO/VIS3KOjZzAXfgg1F1TiQG+3NwWOfI8s+sH7KIEFAot87pEF30ImGOI2nPS3V0Hg0VNeFCKbyBonw7cdhBVozkp76NlX8IQx4ORN47djLIoRyOHBtFhRcDtSMpQDjHtc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 155A24BA2E21 X-SNCR-Rigid: 693FF8BE001CCB15 X-Originating-IP: [86.143.185.36] X-OWM-Source-IP: 86.143.185.36 X-OWM-Env-Sender: jon DOT turney AT dronecode DOT org DOT uk X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdefleejjecutefuodetggdotefrodftvfcurfhrohhfihhlvgemuceutffkvffkuffjvffgnffgvefqofdpqfgfvfenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvfhfhvegjtgfgsehtjeertddtvdejnecuhfhrohhmpeflohhnucfvuhhrnhgvhicuoehjohhnrdhtuhhrnhgvhiesughrohhnvggtohguvgdrohhrghdruhhkqeenucggtffrrghtthgvrhhnpeelhfejvdejledtkeefieeufeegveeitdekheegfeevueehhfefkeejleelgfelkeenucffohhmrghinhepghhithhhuhgsrdgtohhmnecukfhppeekiedrudegfedrudekhedrfeeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehhvghloheplgduledvrdduieekrddurddutdelngdpihhnvghtpeekiedrudegfedrudekhedrfeeipdhmrghilhhfrhhomhepjhhonhdrthhurhhnvgihsegurhhonhgvtghouggvrdhorhhgrdhukhdprhgvvhfkrfephhhoshhtkeeiqddugeefqddukeehqdefiedrrhgrnhhgvgekiedqudegfedrsghttggvnhhtrhgrlhhplhhushdrtghomhdprghuthhhpghushgvrhepjhhonhhtuhhrnhgvhiessghtihhnthgvrhhnvghtrdgtohhmpdhgvghokffrpefiuedpoffvtefjohhsthepsghtphhrughrghhotddtjedpnhgspghrtghpthhtohepvddprhgtphhtthho pegthihgfihinhestgihghifihhnrdgtohhmpdhrtghpthhtohepthgrkhgrshhhihdrhigrnhhosehnihhfthihrdhnvgdrjhhp X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean X-VadeSecure-score: verdict=clean score=0/300, class=clean Message-ID: <9d058204-fb3f-43b4-9e32-6adc7af12ff4@dronecode.org.uk> Date: Tue, 16 Dec 2025 13:11:15 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Recent testsuite/winsup.api/pthread/cancel2 failure To: Takashi Yano References: <20251214162637 DOT 1ee05b084788ba073fe94670 AT nifty DOT ne DOT jp> <20251214163936 DOT 6841fc62145d8f54cfa31fe7 AT nifty DOT ne DOT jp> Content-Language: en-US Cc: cygwin AT cygwin DOT com In-Reply-To: <20251214163936.6841fc62145d8f54cfa31fe7@nifty.ne.jp> X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Jon Turney via Cygwin Reply-To: Jon Turney Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" On 14/12/2025 07:39, Takashi Yano via Cygwin wrote: > On Sun, 14 Dec 2025 16:26:37 +0900 > Takashi Yano via Cygwin wrote: > >> Recently, I have concerned that testsuite winsup.api/pthread/cancel2 fails >> consistently. >> >> https://github.com/cygwin/cygwin/actions/runs/19926408142/job/57127200619 Thanks very much for looking into this! I have the vague idea that this problem started showing up (more?) when the CI VM was upgraded from Windows Server 2022 to Windows Server 2025, but I guess that's maybe just timings... >> >> I'm not sure why this happens, but it also falis in my local environment. >> I looked into this issue a bit, and found that access violation happnes >> in CloseHandle() in _cygtls::remove(). >> >> And I am also not sure why at all, cancel2 works if CloseHandle()'s are >> replaced with NtClose() as follows. I think this is just the difference between the two calls: CloseHandle generates an exception whereas NtClose returns an error code if the handle is invalid. Doesn't really explain whats wrong with the handle, though. >> >> diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc >> index 13d133f47..249c8cb18 100644 >> --- a/winsup/cygwin/cygtls.cc >> +++ b/winsup/cygwin/cygtls.cc >> @@ -118,7 +118,7 @@ _cygtls::remove (DWORD wait) >> { >> HANDLE h = signal_arrived; >> signal_arrived = NULL; >> - CloseHandle (h); >> + NtClose (h); >> } >> >> if (locals.drivemappings) >> @@ -148,7 +148,7 @@ _cygtls::remove (DWORD wait) >> if (mutex) >> { >> ReleaseMutex (mutex); >> - CloseHandle (mutex); >> + NtClose (mutex); >> } >> } >> >> >> Any idea? > > I forgot to mention that the thread crashes when canceled with > PTHREAD_CANCEL_ASYNCHRONOUS. > > PTHREAD_CANCEL_DEFERRED works without the problem. -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple