DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 47V6vh5s4160673
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=faFCa3bu
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2006C386076A
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1725087462;
	bh=+UhzyfRlnP3rXt6iKl9tF1RUYQR5jPR3bibWeYvXxOM=;
	h=References:In-Reply-To:Date:Subject:To:Cc:List-Id:
	 List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
	 From:Reply-To:From;
	b=faFCa3bukY4t6pIuQGHZLpjS2xA8jFz8BHcFjjcbZQwVmaQYW7HNHpvqfLHAAmaQV
	 oiykFMJtqR2+TZsxdbUhi71sRZjG5kZIsZTdm1zNVqiaWRpEMaFSSseuXhxzXSinSY
	 MzyctvMrxckIQ9fbsbzFGcdv8JPpeLfT5u4jg6TE=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C285F3858420
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C285F3858420
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725087442; cv=none;
 b=orQr6cfgCvqlMQcT4SGuOYbEo7beum5Ndc/QUGnKsDZxf4n7rz534doxdwRv7LWWIe7epWSPX2qcxInOKPFZmtmpnKFeCUc4lwwoOR9+S2kdy53bAzge3lJ/U0uomhnM8AC+bAW1NZQsSLftLhSSBJuteuPx7v11elkVIaEWNZo=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1725087442; c=relaxed/simple;
 bh=vOgm6oaZ8cfvWRfSSuVSB+DPmh6SYkUUJVVAtFgBg90=;
 h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;
 b=dv6D1L9AT2PLOqJY5Nc0W+ljfZgS+uG5k3deTjo1aJ6EoXJuHK3Ysl3K5IKFajGh4RVha+Eou6ZNoGeNj77XxgmVvwVbpZadBuG6rQlG56LwY3MYatnLDIHU1srBTt6vGrjrXSbMVPSTEWBEGC+Oa6YnzE4++1gNnsTSNfptdW8=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1725087439; x=1725692239;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=t4S17mhDjx8Iov69T3wKCeqgsTYvTo2G+cFY7P0So0g=;
 b=B2JdDZ271Olny9TbiWp+8HPKthPmJO71JbzvaOODQBEv5FgYpF63gtiIr8kku69360
 w9R94OvbR6NYXL5yGP78P2REOxY8cwmNu+HY6yt8PFVeMqFXtwW2kldtIHt7TSLlw4fM
 eAWOO2HbZDrsyY2R/EoFff3eBdrjNf8iXzJHA2qVfY5nDVKQqdfTYJNmW+WvhLfz5H4a
 z5XPsKD+i6Gmw+tu22a5BkjHUxwKAlx0ukTIxnWj7bukiXAmdyfKpQkoS9aMQ0aoqtnC
 H9zQw8I8d9y+WtVrycQ1fXOu8YnH0agESRrjpUCr0/XaBzjy6eDT4oM6Lnj6JlO5fwLy
 dp3w==
X-Gm-Message-State: AOJu0YwHDq0/I1Dxc2VSEEKPugTtDTN87+q9YTMYGKDTBZUBr7rZYfqc
 b+z1KB1VQMKqPvHexF8mZyBfH06lMAdna3ucnucZfF/LDtWtBnSAnGLY6hkbwt+HDPIP/Ig9pp7
 NP0yUURzJiD8Lx5ucNL12NFYTxPTe45Y6
X-Google-Smtp-Source: AGHT+IFs3mtLGn5I7yCycf7v/LHFXcrCjqgTWIIJKRNZamkMiHBLNflutuS8BrOu0UbeEolHysTNpM7LuyiKL7hiha4=
X-Received: by 2002:a17:907:7286:b0:a86:beb2:1d6d with SMTP id
 a640c23a62f3a-a89827a4283mr932017666b.26.1725087438688; Fri, 30 Aug 2024
 23:57:18 -0700 (PDT)
MIME-Version: 1.0
References: <CAEo=LZ_0BzEDAd7Tb_CgfjX=ZJ2E59pN4a2XOE7wuf=kS_89+w@mail.gmail.com>
 <20240831113303.4e8b51e03796e2fedc3cb79d@nifty.ne.jp>
 <CAEo=LZ9aqvmKW+K6YQWMKFePyG5vNvjUqCvfKzkwacbT7prCDA@mail.gmail.com>
 <20240831142004.2537636bb9f474db1e903604@nifty.ne.jp>
In-Reply-To: <20240831142004.2537636bb9f474db1e903604@nifty.ne.jp>
Date: Sat, 31 Aug 2024 14:57:07 +0800
Message-ID: <CAEo=LZ8Szmr8e9MU3_CgOWjv0vYVNim-=Zjro6HEfXeTZYYbuw@mail.gmail.com>
Subject: Re: cygwin application on MsTerminal, enabling win32-raw-mode results
 in runway memory/CPU usage.
To: Takashi Yano <takashi.yano@nifty.ne.jp>
Cc: cygwin@cygwin.com
X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE,
 RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP,
 T_SCC_BODY_TEXT_LINE 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-Content-Filtered-By: Mailman/MimeDel 2.1.30
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Adamyg Mob via Cygwin <cygwin@cygwin.com>
Reply-To: Adamyg Mob <adamyg.mob@gmail.com>
Content-Type: text/plain; charset="utf-8"
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 47V6vh5s4160673

I raised the same question under:
https://github.com/microsoft/terminal/issues/17824

*cons_master_thread() should *possibly maintain a local key cache and not
push back events.
Alternatively, from research these pseudo key events have Vk=0/Sc=0 values
(only char and down are set);  as such peek the console input queue and
don't process the input stream if detected.

Note,
WriteInputConsole is now considered as a *wrong-way verb
<https://learn.microsoft.com/en-us/windows/console/console-buffer-security-and-access-rights#wrong-way-verbs>*
for this buffer.
Applications remoting via cross-platform utilities and transports like SSH
may not work as expected if using this API
https://learn.microsoft.com/en-us/windows/console/writeconsoleinput

On Sat, Aug 31, 2024 at 1:20 PM Takashi Yano <takashi.yano@nifty.ne.jp>
wrote:

> Thanks for the pointer. Unfortunately, the document does not mention
> about the behaviour of WriteConsoleInput() in the win32-inpu-mode.
>
> I expected that ReadConsoleInput() returns the INPUT_RECORDS which
> WriteConsoleInput() sends. However, that does not seem true in this
> mode.
>
> On Sat, 31 Aug 2024 12:24:46 +0800
> Adamyg Mob wrote:
> >  *One suspect is the fhandler_console::cons_master_thread (), which
> > attempts to mine signals within the input stream; yet it may not handle a
> > single key being represented by multiple events.*; furthermore one of the
> > few uses of WriteConsoleInput
> > Is there any means of disabling the feature for testing?
>
> There is no other means than modifying the source code of cygwin1.dll
> and rebuild it. I already tried that and the problem disappeard.
>
> --
> Takashi Yano <takashi.yano@nifty.ne.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

