From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: Bogus exit code 127 from a child process
Date: Sun, 17 Mar 2024 21:15:17 +0900 [thread overview]
Message-ID: <20240317211517.40cfbe0a664f7c7fe3d6e73d@nifty.ne.jp> (raw)
In-Reply-To: <20240317210358.ad701873dc5cfc9a3026dc0c@nifty.ne.jp>
[-- Attachment #1: Type: text/plain, Size: 2951 bytes --]
On Sun, 17 Mar 2024 21:03:58 +0900
Takashi Yano wrote:
> On Sun, 17 Mar 2024 19:21:16 +0900
> Takashi Yano wrote:
> > On Sun, 17 Mar 2024 13:03:40 +0300
> > Alexey Izbyshev wrote:
> > > On 2024-03-17 12:27, Takashi Yano wrote:
> > > > On Sun, 17 Mar 2024 12:01:55 +0300
> > > > Alexey Izbyshev wrote:
> > > >> On 2024-03-17 11:44, Takashi Yano wrote:
> > > >> > On Sun, 17 Mar 2024 11:14:16 +0300
> > > >> > Alexey Izbyshev wrote:
> > > >> >> Hello,
> > > >> >>
> > > >> >> I've been getting occasional "Error 127" from make -jN on seemingly
> > > >> >> random jobs. After reducing the set of jobs and eventually eliminating
> > > >> >> make, I've arrived to this one-liner:
> > > >> >>
> > > >> >> bash -c 'true & true & wait -n || echo 1: $? && wait -n || echo 2: $?'
> > > >> >>
> > > >> >> When run repeatedly, the second "wait -n" often reports 127.
> > > >> >>
> > > >> >> I've reproduced this in the following environments:
> > > >> >>
> > > >> >> * Cygwin 3.5.1, Windows 10 22H2 x64
> > > >> >> * Cygwin 3.4.6, Windows 10 22H2 x64 and Windows 7 x64
> > > >> >>
> > > >> >> I couldn't reproduce it in Cygwin 3.3.6 (WOW64) on Windows 7 x64.
> > > >> >
> > > >> > Could you please try latest cygwin 3.6.0 (TEST) ?
> > > >>
> > > >> Tested with 3.6.0-0.82.gfc691d0246b9 on Windows 10 22H2 x64, the
> > > >> problem
> > > >> still occurs.
> > > >
> > > > In my evrironmen, trial for 1 hour does not reproduce the issue.
> > > > Could you please let us know your environment, i.e. CPU, amount of
> > > > memory, and so on?
> > >
> > > It's been reproduced in a variety of environments:
> > >
> > > * Windows 10 22H2 x64, Intel Core i7 11700, 32 GB RAM
> > > * Windows 10 22H2 x64, Intel Core i7 9700, 32 GB RAM
> > > * Windows 10 22H2 x64, Intel Core i7 6700, 32 GB RAM
> > > * Windows 7 SP1 x64, Intel Core i7 6700, 32 GB RAM
> > >
> > > I'm surprised that you're not hitting it very quickly. The following
> > > loop usually fails after a few iterations (rarely a hundred or so) in my
> > > tests:
> > >
> > > while bash -c 'true & true & wait -n || { echo 1: $?; exit 1; } && wait
> > > -n || { echo 2: $?; exit 1; }'; do echo $((i++)); done
> >
> > Thanks. My main PC still runs the above test for more than 15000 counts.
> > So, I tried another PC which CPU is Core i5 540M and could reproduce
> > the issue about 1 time per a few hundreds count.
> >
> > I also tried to run sleep 0.1 instead of true, then, the issue happens
> > 1 time per a few decades counts.
> >
> > I'll look into this problem. Thanks for the report.
>
> In my environment, the issue is reproducible even with cygwin 3.3.6
> (32bit, i.e. WOW64) and bash 4.4.12(3)-release (i686-pc-cygwin).
>
> What are the versions of bash in each systems?
And, the attached simple test case in C which does very similar things
with bash command could not reproduce the problem.
Can you reproduce the issue with attached STC?
--
Takashi Yano <takashi.yano@nifty.ne.jp>
[-- Attachment #2: repr.c --]
[-- Type: text/x-csrc, Size: 490 bytes --]
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int status;
int num = 2;
int cnt = 0;
if (argc > 1) num = atoi(argv[1]);
while (1) {
for (int i=0; i<num; i++)
if (fork() == 0) {
execl("/usr/bin/sleep", "sleep", "0.1", NULL);
}
for (int i=0; i<num; i++) {
waitpid(-1, &status, 0);
if (WEXITSTATUS(status)) {
printf("%d: %d\n", num, WEXITSTATUS(status));
return 1;
}
}
}
return 0;
}
next prev parent reply other threads:[~2024-03-17 12:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-17 8:14 Alexey Izbyshev
2024-03-17 8:44 ` Takashi Yano
2024-03-17 9:01 ` Alexey Izbyshev
2024-03-17 9:27 ` Takashi Yano
2024-03-17 10:03 ` Alexey Izbyshev
2024-03-17 10:21 ` Takashi Yano
2024-03-17 12:03 ` Takashi Yano
2024-03-17 12:15 ` Takashi Yano [this message]
2024-03-17 12:35 ` Takashi Yano
2024-03-17 12:50 ` Dimitry Andric
2024-03-17 13:10 ` Dimitry Andric
2024-03-18 3:09 ` Takashi Yano
2024-03-18 4:58 ` Takashi Yano
2024-03-18 11:08 ` Alexey Izbyshev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240317211517.40cfbe0a664f7c7fe3d6e73d@nifty.ne.jp \
--to=takashi.yano@nifty.ne.jp \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).