delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/07/03/10:10:20

DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 463EAJOL1868418
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=cESaIoic
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3228C3864832
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1720015817;
bh=dJtBMp9ChcgrLAovBU2Uu+/afMmETZ+P8bm/ixz4heU=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=cESaIoic1x+eAkkqLLA1j2CvDW0qPo0UmarOI/x3bekF2s/OYg2hIFxELDza1v0oR
z+uVukzWE3jQlnb/dSvr4SEjT50pNw8dMOsIbnj11mcR1bJosoG0TNCodfqWzqahhU
wBZ+TnHMhODYYmzfkMBIDIuqWyBsZGslp1Zq4JZQ=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DBF6F3860769
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DBF6F3860769
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720015762; cv=none;
b=nP1nHWCTRN2bl+LGnG8Zr3jvJ8/zjLjsVJo38QBmtCP3vGMipOhoZRhUurOKeEn8e6PIaEkz73x6332ctJUfXu9sYxCeu66BNT3h54UvYi2Lyq11i8Hh5HTalg4wE7o9plg1/1s8haPKBnJAyUZSv1/l/DPKLmDSJlwIkUiaAW8=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1720015762; c=relaxed/simple;
bh=RuTXhSQiboujQQOnU+yhvxdvaX9f9PEmiRNsZyBYDO0=;
h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature;
b=aFVoGWvXZNx8BBJgQAKokHT2N6yxNAcgVzjVlq9sUhnCTol7nufaSfpLXtzciZCTtfbjBj+hM1cytEcbrpVLVuy/UUb0uT8Jnf4NakY1MQhbNrPVqnYlVqE5qSAX2HL5kqa55keEqIliUqX9+cP+3vNsx/laMnyRnsj+GTSZ1Uc=
ARC-Authentication-Results: i=1; server2.sourceware.org
Date: Wed, 3 Jul 2024 23:09:16 +0900
To: cygwin AT cygwin DOT com
Subject: Re: cygwin application hangs on closing console
Message-Id: <20240703230916.05196d9fa263da9b2ec18f54@nifty.ne.jp>
In-Reply-To: <20240702194515.01a1e2cf1f2378b412ad3712@nifty.ne.jp>
References: <d268ca90-3c5b-4de6-9dd5-320ee713283c AT johannesthoma DOT com>
<20240423035104 DOT 85352f8a8d821c0f4d569d18 AT nifty DOT ne DOT jp>
<b71816f0-633c-4eaf-b9d6-955b10e4866a AT johannesthoma DOT com>
<20240423192606 DOT 7b4aa04685afca2525eb5ed3 AT nifty DOT ne DOT jp>
<6dd8a568-88c0-42d5-aa46-b09247cdecec AT johannesthoma DOT com>
<b67fc4f5-3fbb-454a-a0ce-da4f987924dc AT johannesthoma DOT com>
<d00f900a-e70c-4a2b-9570-0d3c9fcd45d2 AT SystematicSW DOT ab DOT ca>
<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>
<fb960e5d-ccdd-474b-a046-5178563d4200 AT johannesthoma DOT com>
<20240701222020 DOT bf102502bb184e4b30f1c52b AT nifty DOT ne DOT jp>
<20240702194515 DOT 01a1e2cf1f2378b412ad3712 AT nifty DOT ne DOT jp>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, SPF_HELO_PASS,
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 <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Takashi Yano via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

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.

-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>

-- 
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019