X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EA5EF384640F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1593712221; bh=05Rnho8fcsFj/3rKYNmognjO9/tgFGH2SyEK6JH0sHY=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=H5XhhoYnNmOHoye1QIlB7SSgipoeWVvwE3WxUwFMcHbGLuDWbe7MLix08hkut+eqU lDWmRWHMt3ZFssU0NN3gwcRDO7HiIhJ+9MEDLQWOqBzSRHIF2D3+9gujVEcukoXwvZ DS1gv1caoUJoHULg2f0okUuR0XDNFDrTgBJW6bhA= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D46C83858D34 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=jzPxSwAv5GO4m6qvx+edGtRxdcguLBtQSN40qWOXvhw=; b=cG+GMcmodQWQmyA2wllNemTJfZDmI4mMAj41lh1xu4z42OPMYrRrugXEzaTNC38+YO kE4Yi09K7jdlb7IyY6jHPPO+4fUY28nxhjnNmeJaK9iklhTFGPYRrfnV+W54qy50Vr/+ zxp6tQn/x1yaNlj7+6DCB+q1R7uuLbL/cWbh845aSXZUW+tdQngYQ9SAJyE1tASJtmSq 60a7VnN9bwp1PugJr/MGpJ6udipgb5f5pxFjio9tRoy92qBR/zuL114gPG8JPz+hRbpC BlBZK9OprjZlYHLsI8qd+zjPo1hVQs9viYGconxELqcpeJUX7yv1z18wx1eDm95qaXoq b1Ug== X-Gm-Message-State: AOAM5304BYLKln7WrdOywXRTbkvw6+A0GWCqncjYwEraHiGcvA8n4njH SeTl0RVjliljOywqR6pxJBO/ZxXA0VCjQrgfC2ny27AN X-Google-Smtp-Source: ABdhPJyTTrDrKxKtKDymGNV8wl8rYRv4ob5n6zVAYPV5Ohutq7MPbJGjoUTJPmJCEJEZxDspfwkDNLLHFkKKzrmjQ0U= X-Received: by 2002:aa7:d3cd:: with SMTP id o13mr35286821edr.176.1593712216776; Thu, 02 Jul 2020 10:50:16 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 2 Jul 2020 19:50:06 +0200 Message-ID: Subject: Re: name pipe problem: 1 writer, multiple concurrent readers To: cygwin AT cygwin DOT com X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_LINEPADDING, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: =?utf-8?q?Morten_Kj=C3=A6rulff_via_Cygwin?= Reply-To: =?UTF-8?Q?Morten_Kj=C3=A6rulff?= Content-Type: text/plain; charset="utf-8" Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 062HolXg026763 > > On 5/19/2020 11:20 AM, Morten Kjærulff wrote: > > On Tue, May 19, 2020 at 3:55 PM Ken Brown via Cygwin wrote: > >> > >> On 5/19/2020 7:26 AM, Morten Kjærulff via Cygwin wrote: > >>> Hi, > >>> > >>> The following script: > >>> > >>> #!/bin/sh > >>> > >>> rm -f t.pip t.txt > >>> > >>> mkfifo t.pip > >>> printf "line1\nline2\n" >t.txt > >>> > >>> ps > >>> > >>> { > >>> while true ; do > >>> cp t.txt t.pip > >>> done > >>> } & > >>> > >>> rm -f t.rc.* > >>> for rc in 0 1 2 3 4 5 6 7 8 9 ; do > >>> { > >>> diff t.pip t.txt > >>> echo $? >t.rc.$rc > >>> } > >>> done > >>> echo result1 start > >>> ls t.rc.* | wc -l > >>> cat t.rc.* > >>> echo result1 end > >>> > >>> rm -f t.rc.* > >>> for rc in 0 1 2 3 4 5 6 7 8 9 ; do > >>> { > >>> diff t.pip t.txt > >>> echo $? >t.rc.$rc > >>> } & # run the readers in parallel > >>> done > >>> sleep 10 > >>> echo result2 start > >>> ls t.rc.* | wc -l > >>> cat t.rc.* > >>> echo result2 end > >>> > >>> ps > >>> > >>> Give me output like this: > >>> > >>> $ ./tpip.sh > >>> PID PPID PGID WINPID TTY UID STIME COMMAND > >>> 1642 1600 1642 65264 cons1 1058872 13:18:58 /usr/bin/sh > >>> 1600 1 1600 72728 cons1 1058872 13:18:33 /usr/bin/bash > >>> 1645 1642 1642 42088 cons1 1058872 13:18:58 /usr/bin/ps > >>> result1 start > >>> 10 > >>> 0 > >>> 0 > >>> 0 > >>> 0 > >>> 0 > >>> 0 > >>> 0 > >>> 0 > >>> 0 > >>> 0 > >>> result1 end > >>> 0a1,2 > >>>> line1 > >>>> line2 > >>> diff: t.pip > >>> result2 start > >>> 1 > >>> 2 > >>> result2 end > >>> PID PPID PGID WINPID TTY UID STIME COMMAND > >>> 1690 1688 1642 104032 cons1 1058872 13:19:01 /usr/bin/diff > >>> 1681 1642 1642 95012 cons1 1058872 13:19:00 /usr/bin/sh > >>> 1642 1600 1642 65264 cons1 1058872 13:18:58 /usr/bin/sh > >>> 1684 1681 1642 99624 cons1 1058872 13:19:00 /usr/bin/diff > >>> 1678 1676 1642 94532 cons1 1058872 13:19:00 /usr/bin/diff > >>> 1688 1642 1642 88864 cons1 1058872 13:19:01 /usr/bin/sh > >>> 1698 1642 1642 104820 cons1 1058872 13:19:11 /usr/bin/ps > >>> 1692 1642 1642 66572 cons1 1058872 13:19:01 /usr/bin/sh > >>> 1677 1674 1642 86692 cons1 1058872 13:19:00 /usr/bin/diff > >>> 1646 1642 1642 30888 cons1 1058872 13:18:58 /usr/bin/sh > >>> 1600 1 1600 72728 cons1 1058872 13:18:33 /usr/bin/bash > >>> 1686 1685 1642 14320 cons1 1058872 13:19:01 /usr/bin/diff > >>> 1685 1642 1642 25608 cons1 1058872 13:19:00 /usr/bin/sh > >>> 1676 1642 1642 104212 cons1 1058872 13:19:00 /usr/bin/sh > >>> 1689 1642 1642 98004 cons1 1058872 13:19:01 /usr/bin/sh > >>> 1674 1642 1642 44152 cons1 1058872 13:19:00 /usr/bin/sh > >>> 1680 1646 1642 28224 cons1 1058872 13:19:00 /usr/bin/cp > >>> 1682 1679 1642 43612 cons1 1058872 13:19:00 /usr/bin/diff > >>> 1694 1692 1642 67736 cons1 1058872 13:19:01 /usr/bin/diff > >>> 1683 1642 1642 93544 cons1 1058872 13:19:00 /usr/bin/sh > >>> 1679 1642 1642 90188 cons1 1058872 13:19:00 /usr/bin/sh > >>> 1691 1689 1642 68560 cons1 1058872 13:19:01 /usr/bin/diff > >>> 1687 1683 1642 83952 cons1 1058872 13:19:01 /usr/bin/diff > >>> > >>> $ > >>> > >>> That is, when I run the readers in sequence, no problem, but when I > >>> run the in parallel, they either hang or t.pip seems empty. > >> > >> The current cygwin release doesn't support multiple concurrent readers of a > >> FIFO. I have recently added that support, which should appear in the next > >> release, although there are still bugs to be fixed. See > >> > >> https://cygwin.com/pipermail/cygwin-patches/2020q2/010195.html > >> > >> Ken > > Great! > > Let's keep the discussion on the mailing list > > Then we will have a read-only file (pipe), which is the output of an > > abitrary command, right? > > Yes. > > > Can we have multiple concurrent writers and one reader, which would > > become a write-only file, which becomes the input of an abitrary > > command? > > That already exists, although I found and fixed some bugs when I was developing > the multiple reader support. > > > Anywhere I can see the plans for next release, if any? > > That's up to Corinna. > > Ken I think we got a new release around the beginning of June, right? You said that there were still issues (I can confirm). If it can help, here is the output I see today of above scripts: $ ./tp.sh PID PPID PGID WINPID TTY UID STIME COMMAND 1766 1763 1763 136424 cons1 1058872 19:48:52 /usr/bin/ps 1708 1 1708 141992 cons1 1058872 19:42:22 /usr/bin/bash 1763 1708 1763 146792 cons1 1058872 19:48:52 /usr/bin/sh result1 start 10 0 0 0 0 0 0 0 0 0 0 result1 end 0a1,2 > line1 > line2 0 [fifo_reader] diff 1806 C:\cygwin\bin\diff.exe: *** fatal error - Can't update my handlers, Win32 error 87 result2 start 4 0 1 0 0 result2 end PID PPID PGID WINPID TTY UID STIME COMMAND 1815 1763 1763 110264 cons1 1058872 19:48:56 /usr/bin/sh 1809 1807 1763 136060 cons1 1058872 19:48:56 /usr/bin/diff 1813 1767 1763 143812 cons1 1058872 19:48:56 /usr/bin/cp 1814 1811 1763 88380 cons1 1058872 19:48:56 /usr/bin/diff 1805 1802 1763 152044 cons1 1058872 19:48:56 /usr/bin/diff 1811 1763 1763 133876 cons1 1058872 19:48:56 /usr/bin/sh 1708 1 1708 141992 cons1 1058872 19:42:22 /usr/bin/bash 1767 1763 1763 121096 cons1 1058872 19:48:53 /usr/bin/sh 1806 1804 1763 148760 cons1 1058872 19:48:56 /usr/bin/diff 1810 1763 1763 4740 cons1 1058872 19:48:56 /usr/bin/sh 1807 1763 1763 121336 cons1 1058872 19:48:56 /usr/bin/sh 1804 1763 1763 120764 cons1 1058872 19:48:55 /usr/bin/sh 1802 1763 1763 108068 cons1 1058872 19:48:55 /usr/bin/sh 1821 1763 1763 72428 cons1 1058872 19:49:06 /usr/bin/ps 1816 1815 1763 115876 cons1 1058872 19:48:56 /usr/bin/diff 1812 1810 1763 96120 cons1 1058872 19:48:56 /usr/bin/diff 1763 1708 1763 146792 cons1 1058872 19:48:52 /usr/bin/sh /Morten -- 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