X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 23A1A385841D
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1634666208;
	bh=G9e67rOHR8WBnhv6JpamBzhXAj/GdNCULyfK5e8FX1o=;
	h=Date:To:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
	 From;
	b=NTjeF7jreCzA6hRUXtJZaXeeeeROSEOBq5C/XFRwVpz4DrF09md6NdJCbgLjEsKno
	 1TMcnltYPkfOd0LE92qEZ4KlIfWRnXWfGLGj8FkY1vJkURQQm3OO+wYhC9EQPkQcYh
	 rWNOjNC6N+3xGoca+QG6bWDsvh68B1UGgbE/c7K4=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C93CB3858C2C
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1634666175; bh=hJCr4fOlX5ELVhrtRWv8QxrqELiR+iSIPZtoROyk2Po=;
 h=X-Sonic-MF:Date:From:To:Subject:From:Subject;
 b=QEVAc+w2u6zTC8QhhCSzACBVGjvr6ymVWIkJkt980wb317p3K2TITBHYrjEzBNuI+b9WgxdGBodjQeohzwg5mavaXPki5A/voRj/X/Hgc5+YPvOMpAdcMRUjPrTm7htDoN3dzd5wVgdHuyIXTA2SO0q0IG1tJBJiHFZ1ryQPmwDfbQzSz6iqxoE9Tqcxiy6PzU7Hqj0mEPW8OH757G0d+4d0zpgVRExtyNDlhcjasUIic8h2+YJektGFyo9yK8FxzF/vefK1fc5MRnQkacNU8ia9L3HOlC9r10rE9suR3X2WTP16/W3bi3Z9WhskCFLfb+iyc+eGZPqda0DcVcgIDg==
X-YMail-OSG: nV8Ty1QVM1mlF9QMdJiQrmiePKDqT.9cV8iqpNa9nvUVT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Xd6JiiOZk.1KFgdFvxVTr2rG3QlVS.Dw86DZdJgk81UEHTGEOaRBn1vYmbPZee
 CRWTvmpV3SSl9jwfzHoS5.gxF8vtqpgEHPjPvcNBpVu73LpPNdmYXb6cetgDF2xOjPlRODGhfqYY
 eRIghTskEKcWD2o0_buKB1AexnWcS.N5Azc.CqjptIsL1i5ZJuOhtRnkabcM80WT2xkVUc18-
X-Sonic-MF: <chris.hardison@yahoo.com>
Date: Tue, 19 Oct 2021 17:56:12 +0000 (UTC)
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Message-ID: <1673936147.4682792.1634666172598@mail.yahoo.com>
In-Reply-To: <cfe6d4b7-fdac-6618-505a-2f21439598fd@SystematicSw.ab.ca>
References: <764795149.682120.1633022545890.ref@mail.yahoo.com>
 <764795149.682120.1633022545890@mail.yahoo.com>
 <552722739.4126571.1634558495795@mail.yahoo.com>
 <cfe6d4b7-fdac-6618-505a-2f21439598fd@SystematicSw.ab.ca>
Subject: Re: Hanging cygwin processes in Windows Server 2019
MIME-Version: 1.0
X-Mailer: WebService/1.1.19116 YMailNorrin
X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE,
 RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, REPTO_QUOTE_YAHOO,
 SCC_5_SHORT_WORD_LINES, SPF_HELO_NONE, SPF_PASS,
 TXREP autolearn=no autolearn_force=no version=3.4.4
X-Spam-Level: *
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
 server2.sourceware.org
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
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: "chris.hardison--- via Cygwin" <cygwin@cygwin.com>
Reply-To: "chris.hardison@yahoo.com" <chris.hardison@yahoo.com>
Content-Type: text/plain; charset="utf-8"
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
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 19JHuoZj028611

 Brian,
Thanks for the feedback.  I came across stdbuf earlier today and thought for sure that was the answer but when I showed it to my co-worker he said he had already tied it with no luck, both with -i0 -e0 -o0 and with -oL.
Actually, what is working is:`\\cygwin\\bin\\mintty.exe -w hide /bin/dash -c "/bin/ps -W > /tmp/${PID}.out"`;
chomp(@output = `type \\cygwin\\tmp\\${PID}.out && del \\cygwin\\tmp\\${PID}.out`);
I'm still hoping for a better solution.

Thanks!
chris

    On Tuesday, October 19, 2021, 12:11:42 PM EDT, Brian Inglis <brian.inglis@systematicsw.ab.ca> wrote:  
 
 On 2021-10-18 06:01, chris.hardison wrote:
> On Thursday, September 30, 2021, 01:26:37 PM EDT, chris.hardison wrote:
>> My cygwin install looks good and things seem to work perfectly for
some time (hours or days), then a cygwin process started by a windows
process that is usually a child process of a windows service written in
perl will hang and then most all other cygwin processes will hang or
take a very long time to return.  The simplest example is a call to
\cygwin\bin\ps from powershell. That normally returns with sub-second
response time.  Once the problem occurs that call to \cygwin\bin\ps will
often take several minutes to return.  I've found that killing all
cygwin processes will temporarily resolve the problem.
>> I've read about redirecting NUL to stdin when making the call to
cygwin processes from windows and that didn't seem to help.
>> I've tried "set-processmitigation -name \cygwin\bin\ps.exe
>> -disable ForceRelocateImages" with no real benefit.
>> I've also tried "\cygwin\bin\dash -c /bin/rebaseall" on startup
before the sshd service starts and that didn't seem to help.
>> Any suggestions on how to prevent this problem will be greatly
appreciated.

> The problem seems to be that my cygwin processes that are always the
child or grandchild of a windows service use a console device that is
block buffered rather than character buffered. So using mintty to start
those processes forces character buffered which solves the problem. I'm
looking for cleaner way to force character buffered IO. Here's an
example of the change:
> From
> chomp(@output = `/cygwin/bin/ps -W`);TO
> chomp(@output = `/cygwin/bin/mintty.exe -w hide /bin/dash -c "/bin/ps -W > /tmp/${PID}.out"; sleep 1; type /cygwin/tmp/${PID}.out; del /cygwin/tmp/${PID}.out`);
> Hopefully someone can suggest a simpler solution.

Most Cygwin processes don't care about buffering, as they may be line or 
character buffered from the terminal but block buffered when used with 
pipe or file I/O.
Try using stdbuf(1) instead of mintty to change buffering.
You use it as a command prefix like nohup or time.
Perl may also have ways of changing I/O buffering internally.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

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

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

