delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/03/03/10:11:49

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A5443959E5F
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1614784306;
bh=JGoUlsXXt5idlXkVYZd6yir5GT1ZsuCye+83jyoDIDI=;
h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=yhLfw2R/XD+yz4UTz57FKuS0NDe4W3GepVGRbazGhDpTPN3/PWu6KvPqzIn+E1Bzz
RMaPD34LAg4rLrUsqTBa13QoS+fBWn3enNdHrp+ceCxWzVITR2a0FnYi7hAXjLeR4U
NUWCJqFZwIzd6JiDaWfRxFRjXod6eRpskayiYCwI=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 07A41385041C
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
bh=VAMO6Dd5UojFVCxc7jMUUJvQMKGqNoXy5FtaCmC/exs=;
b=NZlq748G/6dW6ZuGxZh9xRJ/AJd02lL5MVj90eVyVBj6A8Do2B9mpPly25vpW9s8F6
7ctTlxOSTBzTIB1Qnj6MAoYF67g+2/or5pBOMKYc0tGES78e0Tg+rSUpKSmNg+ozlwuD
HE/VEQSYEaUpXMWK+EfzW2b9Le2tkXuqBed7upmBHwW+E0/T102fnAOne4zwz04CjbDM
ihx23RKjFpC0efUg6ja+6ucadtj0hFZZm4fHK8ey8m0nsrY1JfDt2BaN6PX+aJm5vzNQ
OOd62ln0PtNeGne3f1JStwQWetJ7/QFjV1GxCuJOAthHVwHjIHUfrmQlTEYm4X+66nnv
c3qA==
X-Gm-Message-State: AOAM530z1wbLc1yh+5XtK7Ld1cYDYMqr2rVjizFMila7KvdvcVieCVBd
xypLgEHRZMn/TcxJ8/crDdMyQ2UxuyHc09nZKqNVrwtuz5w=
X-Google-Smtp-Source: ABdhPJxIZmaHJUHFJWF7i8UFb9eaF3r8dco4We3HnROj7wWWsZkwkWFTdJJ85xz6Wxgm5rnUyyTkdqcvMtM0WWyAs+A=
X-Received: by 2002:a05:6a00:22ca:b029:1ed:f915:ca98 with SMTP id
f10-20020a056a0022cab02901edf915ca98mr3434664pfj.68.1614784301576; Wed, 03
Mar 2021 07:11:41 -0800 (PST)
MIME-Version: 1.0
Date: Wed, 3 Mar 2021 16:11:30 +0100
Message-ID: <CAM=mnHgAOUYV-DBX+2ttdui7z-qPvgMU6JstnZoPANAXWtiYiw@mail.gmail.com>
Subject: Issue: Reading from stdin in Cywin64 Terminal (first noticed with Git
Bash) with a .Net framework application hangs after some time
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
X-Spam-Status: No, score=-0.5 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 autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
server2.sourceware.org
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
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: Nitro Vent via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Nitro Vent <nitrovent AT googlemail DOT com>
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

I have two .Net console applications targeting .Net Framework 4.7.2,
"produce.exe" and "consume.exe" with their respective sources

using System;using System.Threading;
namespace Produce
{
    class Program
    {
        static void Main(string[] args)
        {
            Thread.Sleep(100);
            Console.WriteLine("Hello World.");
        }
    }
}

and

using System;
namespace Consume
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.In.ReadToEnd();
            Console.WriteLine(input);
        }
    }
}

Running

$ ./produce.exe | ./consume.exe

in Cygwin Terminal I expect the output to be

Hello World.

But there is no output and the second process, consume.exe, hangs at
ReadToEnd().
This was verified by looking at the running processes with ps aux when
running the consume.exe in the background as well as by attaching the
Visual Studio debugger.

Piping produce.exe into cat works correctly.
Piping some more content into consume.exe also fails (e.g. find * /usr |
consume)
Executing the same command in Windows Command works correctly.

Notice that piping into consume.exe works if there is no delay in the
producer.


I had first opened this issue on Github in the git-for-windows project, as
I experienced the issue with Git Bash in Windows first:
https://github.com/git-for-windows/git/issues/3075

I then installed the current version of Cygwin and could replicate the same
issue there.



PS: I have not attached the output of cygcheck because it would reveal
information of my work environment I will not share.

Greetings,

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