From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by sourceware.org (Postfix) with ESMTPS id B80D1385DC34 for ; Tue, 7 Apr 2020 15:10:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B80D1385DC34 Received: by mail-lj1-x22a.google.com with SMTP id b1so4148243ljp.3 for ; Tue, 07 Apr 2020 08:10:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :thread-index:content-language; bh=mv8xmjSPjMHwH8wBKfRL2IZHBpNkIIi4xixFFueKBsk=; b=nVr6qx2fRRrtQ26BSsKk0pw1MiJ3urSl0GKb8H9fuFwc8UFhbHdL/aQhzkrtMmrt0q BKhBBzFU2XbWY970A2UamcGyP4pT+QPSbMcSPR7navn5aaWU7kM0FCgxi4QwE1LIcREj 0+BqAHvdP4DUXTn1aW2kwWc8tLhbjS7uK9iwfWEczwUpMSCZbk4Jt/vEQeYTDll84F9F 1z3bUWDYhf1nsBt4+78JfvqGntdkR62emyhBKUa62FvMzfgr4eHu8/ou3u+5lN431MAS X1+U2NVYhIyOxXS8dFl07H5OuH8T8npRld96iLEfLCUJR72FDQd6vsQp2bl8okrOimxJ LaHw== X-Gm-Message-State: AGi0PuaUDoEMCh7zvGVLLdIocdYVKxhyVh07IjwIeImfxfTOBplgmyAK /4Y1KJYjTp4PtafWXnKOYuXGN62q X-Google-Smtp-Source: APiQypIJSmE5KCIH9ch0j94kjdgk4AOWhSO26tBb3n259A155+/1KOXP8DDkMrwgmRDCVyihfu/oTQ== X-Received: by 2002:a2e:8887:: with SMTP id k7mr2075456lji.193.1586272228259; Tue, 07 Apr 2020 08:10:28 -0700 (PDT) Received: from JOKK (87-249-164-127.ljusnet.se. [87.249.164.127]) by smtp.gmail.com with ESMTPSA id p5sm14926139ljn.99.2020.04.07.08.10.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Apr 2020 08:10:27 -0700 (PDT) From: To: "'cygwin'" Subject: open descriptor to named pipes sometimes fail Date: Tue, 7 Apr 2020 17:10:26 +0200 Message-ID: <000701d60cee$ab67e1b0$0237a510$@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0008_01D60CFF.6EF14DF0" X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdYM7eQ1wHHCfeQFTWaQolhama0YFA== Content-Language: en-gb X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 15:10:31 -0000 This is a multipart message in MIME format. ------=_NextPart_000_0008_01D60CFF.6EF14DF0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Opening a (second) descriptor for (blocking) write sometimes fail The provided test case sometimes succeed, but quite often fail with ENOENT (in various indexes) I haven't dug deeper to find the underlaying cause yet Have anyone experienced this before ? Kristian ------=_NextPart_000_0008_01D60CFF.6EF14DF0 Content-Type: text/plain; name="fifo.cpp" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="fifo.cpp" #include #include #include #include #include #include #include #include int print_error(const int line, const int index, const int error) { printf("%d\t%d\t%s\n", line, index, strerror(error)); return error; } #define HANDLE_ERROR(result) do{if(result < 0){return = print_error(__LINE__, idx, errno);}}while(0); int main() { const char *name =3D "/tmp/my_pipe"; /* just in case it exists */ remove(name); for (long idx =3D 0; idx < 1000; ++idx) { const int fifo =3D mkfifo(name, 0666) ? -1 : 0; HANDLE_ERROR(fifo); const int rfd =3D open(name, O_RDONLY | O_NONBLOCK); HANDLE_ERROR(rfd); const int wfd =3D open(name, O_WRONLY); HANDLE_ERROR(wfd); HANDLE_ERROR(close(wfd)); HANDLE_ERROR(close(rfd)); HANDLE_ERROR(unlink(name)); } return 0; } ------=_NextPart_000_0008_01D60CFF.6EF14DF0--