bug-bash
[Top][All Lists]
Advanced

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

Re: background, pipeline, hang


From: Mike Jonkmans
Subject: Re: background, pipeline, hang
Date: Sat, 13 Jul 2019 11:55:08 +0200

On Fri, Jul 12, 2019 at 02:26:52PM -0400, Chet Ramey wrote:
> Date: Fri, 12 Jul 2019 14:26:52 -0400
> From: Chet Ramey <chet.ramey@case.edu>
> To: Mike Jonkmans <bashbug@jonkmans.nl>, bug-bash@gnu.org,
>  bash@packages.debian.org
> Cc: chet.ramey@case.edu
> Subject: Re: background, pipeline, hang
> Reply-To: chet.ramey@case.edu
> 
> On 7/12/19 10:00 AM, Mike Jonkmans wrote:
> 
> > Bash Version: 4.4
> > Patch Level: 20
> > Release Status: release
> > 
> > Description:
> >     A pipeline, with two or more pipes, hangs when a background job is 
> > running.
> >     Only when the background job finishes, the shell prompts again.
> >     Without the background job, the shell prompts immediately.
> > 
> > Repeat-By:
> >     : | : | : ## immediately finishes
> >     sleep 10 &
> >     : | : | : ## this hangs (^C, ^\, ^Z do not help) until the sleep 
> > finishes
> 
> Sorry, I can't reproduce this.
> 
> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Thanks for looking, though.

With the tip of Greg Wooledge (use --norc --noprofile),
from another post, i was able to research this further.


This runs for two seconds:
        bash --norc --noprofile -ic "trap 'tput hs' DEBUG; sleep 2 & :|:|:"

While this immediately finishes:
        bash --norc --noprofile -ic "trap ':' DEBUG; sleep 2 & :|:|:"


I also found something in the (ubuntu)changelog, that might be related.
Quotes from "apt-get changelog bash":
        bash (4.3-6) unstable; urgency=medium
        [...]
        * Apply upstream patches 001 - 008:
        [...]
        - A change to save state while running the DEBUG trap caused pipelines 
to
      hang on systems which need process group synchronization while building
      pipelines.


It seems to have to do with the duration of the command executed in the DEBUG 
trap.
As this also exhibits an unexpected, longer duration:
        bash --norc --noprofile -ic "trap 'sleep 1; echo $SECONDS' DEBUG; sleep 
5 & :|:|:"; echo $SECONDS

Compared to:
        bash --norc --noprofile -ic "trap 'echo $SECONDS' DEBUG; sleep 5 & 
:|:|:"; echo $SECONDS


So this combination is problematic:
- trap on DEBUG where the command takes some time
- something running in the background
- a pipeline with two or more pipes


Hope you can make something of this.

Regards, Mike



reply via email to

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