bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 4.3.42 : shopt -s lastpipe & "no record of process" warnings


From: Jason Vas Dias
Subject: Re: 4.3.42 : shopt -s lastpipe & "no record of process" warnings
Date: Sun, 5 Jun 2016 14:51:20 +0100

The strace log shows that process 8277 is the
bash subshell that runs f() , forks to create 8278,
which forks to execve "some_executable" ;
process 8277 then eads the 8278  output on a pipe,
so it knows when the pipe is closed, amd the strace
log shows 8277 first does a wait4, which returns 8278,
but does NOT get a SIGCHLD event for 8278.
Maybe this is the problem? Since the wait has
already succeeded, no SIGCHLD will be generated.
8277 evidently is not aware that its 8278 child has exited,
and goes on to issue a further wait4 for it which
returns -1 with errno==ECHLD and then emits the
message:
"xxx.sh: line 46: No record of process 8278" .
Line 46 in my script consist of
  function f()
.
This seems buggy to me - I'll try developing a
patch to fix it and will post back here.

Regards, Jason
On 05/06/2016, Jason Vas Dias <jason.vas.dias@gmail.com> wrote:
> With a build of bash 4.3 patchlevel 42
> on a Linux x86_64 system I am getting
> warning messages on stderr when
> running a certain script like:
>    "wait_for: no record of process 8278" .
> Running bash with the script as
> input under strace shows that process 8277
> does a successful wait4(-1,...) which DOES
> return pid 8278 . So why is bash complaining
> it has no record of it ?
> Is bash getting its book-keeping wrong here?
> The script is not using any background
> jobs with '&' or using the 'wait' built-in.
> It is simply doing something like:
> <quote><pre>
> shopt -s lastpipe;
> set -o pipefail;
> function f()
> { some_executable "$@" | {
>      while read line; do { ... ; } done;
>    }
>    return 0;
> }
> ...
> f  $args | { while read result; do
> ...; done ; }
> </pre></quote>
>
> So I'd expect the initial bash process to run
> a subshell bash to invoke the f() function,
> which runs a command child that execve-s
> "some_executable', parsing its output and writing
> to the subshell bash on a pipe, which writes to the
> parent bash on a pipe, which parses it & does whatever.
> Without the lastpipe option, this would be the
> other way round - the parent would run f, and
> its output would be parsed in the subshell
> running the f output parsing loop.
> All this seems to work OK, but why the warning
> message about "no record of process X"?
> Or is this message indicating something has
> gone seriously wrong ?
> Thanks in advance for any replies,
> Regards,
> Jason
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]