Path: csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Mike Jonkmans Newsgroups: gnu.bash.bug Subject: Re: background, pipeline, hang Date: Sat, 13 Jul 2019 11:55:08 +0200 Lines: 71 Approved: bug-bash@gnu.org Message-ID: References: <20190712140057.7F34B12552B@sint.jonkmans.nl> <6c7c3315-d319-d8bd-dfcc-962f9b9ce80a@case.edu> <20190713095508.GB21798@sint.jonkmans.nl> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1563011716 9591 209.51.188.17 (13 Jul 2019 09:55:16 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org, bash@packages.debian.org To: Chet Ramey Envelope-to: bug-bash@gnu.org Content-Disposition: inline In-Reply-To: <6c7c3315-d319-d8bd-dfcc-962f9b9ce80a@case.edu> X-SourceIP: 62.163.69.112 X-Ziggo-spambar: / X-Ziggo-spamscore: 0.0 X-Ziggo-spamreport: CMAE Analysis: v=2.3 cv=PdKBeRpd c=1 sm=1 tr=0 a=ONQKbMlQgRqYTzjcV855Rg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=0o9FgrsRnhwA:10 a=mDV3o1hIAAAA:8 a=xNf9USuDAAAA:8 a=RtTPCSVnAAAA:8 a=qx22nP6uOMZQpnbMeVAA:9 a=CjuIK1q_8ugA:10 a=j4dfj54W6n8A:10 a=_FVE-zBwftR9WsbkzFJk:22 a=SEwjQc04WA-l_NiBhQ7s:22 a=CyNWaimXnoehZj38QlCX:22 X-Ziggo-Spam-Status: No X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.54.34.165 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20190713095508.GB21798@sint.jonkmans.nl> X-Mailman-Original-References: <20190712140057.7F34B12552B@sint.jonkmans.nl> <6c7c3315-d319-d8bd-dfcc-962f9b9ce80a@case.edu> Xref: csiph.com gnu.bash.bug:15161 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 > To: Mike Jonkmans , 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