DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 463EH8hg1871061 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=KAlD2NuI X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 531D33860C37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1720016227; bh=MZlP08rAVy1hYLjIvrNdzAmY4TigA+5er//fyiwlVvI=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=KAlD2NuIJM1QuLijPB08rpiyVNot2qeTTDwsdxmwnIovB4veLmiJ6iFmdbGk3hLy/ b4Z5h4QVfEunwnoukZJKtdVmzQfk1sDmfvrepgLaEP+PEQhQCT05AOzSxLmVgtz7Ch 4tj+1ar601phpMU6gYXJna5b0kVsJX0PqaOPw3e4= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F2F12386100A ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F2F12386100A ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720016198; cv=none; b=o8hiZw6gW2Q7nOsBOtOq4k5AhvZtc0OGEG4w518pXYO159Kpd6PtYUpT+zfXDoqYRJqfkiTGionQpJj9fxDVwujt0nbKzNjG7DKjTofAJH3+1mpRkI+CUpSOwG5yJmcp4P6WeFOMTwBiRB14viXVHbyVgnAu709lThPV4IFVYhU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720016198; c=relaxed/simple; bh=aMfCWOHaJ0LLyM3COktnhTNCIMfkT1zLa2xXEej4XCE=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=iWyNMjbfUL5IU5O0x63KMlRsFqjCvklmWmg8rE5JJuPUse2jVqF15DOTaak5ouuDY0Tz0dYpMHC9lZ5zvXmJKjIw4bM/V3KXlT/XaVx6Fb12MGRPmt8gwU1fdahLJqh+Nq7AScY4/JPDsIghIu4PQQLndN+cqsQYsgVtL8AvfEM= ARC-Authentication-Results: i=1; server2.sourceware.org X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Message-ID: <5b270642-996d-43b5-bbee-90157321a1a4@johannesthoma.com> Date: Wed, 3 Jul 2024 16:16:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: cygwin application hangs on closing console To: Takashi Yano , cygwin AT cygwin DOT com References: <20240423035104 DOT 85352f8a8d821c0f4d569d18 AT nifty DOT ne DOT jp> <20240423192606 DOT 7b4aa04685afca2525eb5ed3 AT nifty DOT ne DOT jp> <6dd8a568-88c0-42d5-aa46-b09247cdecec AT johannesthoma DOT com> <5ed3b0b8-d4f8-454c-951a-fc7b85a7c302 AT johannesthoma DOT com> <95442cfe-a87c-4816-b337-b130e481e3f1 AT johannesthoma DOT com> <20240628211726 DOT c131e0a300046d1fa46f6b53 AT nifty DOT ne DOT jp> <20240629003209 DOT d0bd3cc2961891fb69b55b35 AT nifty DOT ne DOT jp> <20240701222020 DOT bf102502bb184e4b30f1c52b AT nifty DOT ne DOT jp> <20240702194515 DOT 01a1e2cf1f2378b412ad3712 AT nifty DOT ne DOT jp> <20240703230916 DOT 05196d9fa263da9b2ec18f54 AT nifty DOT ne DOT jp> In-Reply-To: <20240703230916.05196d9fa263da9b2ec18f54@nifty.ne.jp> X-Provags-ID: V03:K1:wSBOMiKbPF0GGLVKAzwqUVtXDy26FgrweuGOlli2iJ4o9oaavSf b6f80uBGO2oXVTRq37cdXG8CvOsaeL2Fhonc7uHIGtwy95a+yDAgqE2UCFAQUnYqULtxajh AS+xvC3jhKenRg09ktvoi7w1Hyqn1IPKCU1I1nnMTm4sJx3A8gO4b0YWYXjEFRVnUD2vxpL 3H1GDCTIXP4nTrglJWGIA== UI-OutboundReport: notjunk:1;M01:P0:5K8HLrD2ijQ=;M6ctYOTPeJhsg4SNWkbWBDyugmG MMiEYwpklu7Xjiklxm1LlFYioyOuqMTcyZ76HNZc9h9WwR4BHWPMxPYt5MGGRI3FYrDnROz+f E+XyDF1VtU2pqMlhzPADpyTJSusG982eiyPu8VVUCtFti1mHh9o4VLmgkpQYHssZff73e1E3D CpoMkh465VmEhL3rfORzmyU5yUW2mpd6N9lwsx2PS0ixeIQRoJS0qCNHTR0wVT+RXVmxHZa3u C/2JW+P63+82N30gwltmKkmHFUM+P7CCPTAhJSObITAC+Sls8TK8l2FKFlIlOEAzRSq61dB6M qYh4wmJw7OQWtc3sN5YUhR4Goff5uchR0sh1SaH1MBvX1ffxC/WMpIoJKMUotXzG5hmpYUZFh nHvO5XBy6Jli3WQNy3Z1xtV3no2Stga2Y0xVRXA95IFPUf8BxGrY1GKXtcsz/B7feCl0IzJKN h0P7JI7b4KMmWY7+3epT/GkGwJXjM33QjwzaExihKD9popBfolmuBWLJlqRtf1LBNOjrH0DVw yHnioKjwIMzzW3gUAYp9sbOTCeaP3/8iqlKtdHVLFQs2iNk7lD6ESFDfapDwiaF+62S/b67L6 vdJWpQbncYcufN5nZGKlYGgaybBbksKndtbFONU4ogh8LgdjZd7RCU6pERBbIOWkVYZLNmwF6 rJr4+b79htth43yiFRG21bzWdgqvhoT8YUl/wbpE+OdJ6xE+9DDL7GNVB56U+3sSbzh6xVnhc ZXbdfwq5zQmOYc8XAC/rzDR5XjH3BCNSvGLFOCHtC5eI103O+I1f9o= X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Johannes Khoshnazar-Thoma via Cygwin Reply-To: Johannes Khoshnazar-Thoma Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "Cygwin" Hi Takashi Yano, Am 03.07.24 um 16:09 schrieb Takashi Yano: > On Tue, 2 Jul 2024 19:45:15 +0900 > Takashi Yano wrote: >> On Mon, 1 Jul 2024 22:20:20 +0900 >> Takashi Yano wrote: >>> On Mon, 1 Jul 2024 13:47:56 +0200 >>> Johannes Khoshnazar-Thoma wrote: >>>> Note that the hang does not happen when just running cygwin >>>> applications via terminal windows (like cmd, powershell and >>>> MinTTY). It triggers however when a cygwin application is >>>> run both as a service (I think as SYSTEM account, but I >>>> can ask again) and from a terminal window. >>> >>> Service process usually does not have console. So I think >>> fhandler_console::open()/close() are not called. >>> >>> Do you allocate console for your service process somehow? >> >> I could reproduce your problem by allocating console for >> service process. >> >> I'll look into the problem. Thanks. > > The cause has been clear. As a result, your points and patches > were very spot on. > > get_minor() retuns unique number for each console in a session, > but not unique accross sessions. I looked over that point. > > This is because EnumWindows(), which is used to look for console > windows, cannot enumerate windows accross sessions. This causes > conflict on shared name between sessions (e.g. sessions of different > users, different services, a service and a user session, etc.). > > I'll use GetConsoleWindow() instead of get_minor() to create > shared name. > > Thank you very much for finding this problem. > I'll submit a patch for that and push it shortly. > Thank you very much that is awesome news. I will build and forward a package to our client to verify that this issue is fixed now as soon as the patch is pushed. Thanks again for your hard work on cygwin, it is hard to find bugs in there because there are not that many ... :) Best regards, - Johannes -- 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