Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15161 > unrolled thread

Re: background, pipeline, hang

Started byMike Jonkmans <bashbug@jonkmans.nl>
First post2019-07-13 11:55 +0200
Last post2019-07-13 11:55 +0200
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: background, pipeline, hang Mike Jonkmans <bashbug@jonkmans.nl> - 2019-07-13 11:55 +0200

#15161 — Re: background, pipeline, hang

FromMike Jonkmans <bashbug@jonkmans.nl>
Date2019-07-13 11:55 +0200
SubjectRe: background, pipeline, hang
Message-ID<mailman.1137.1563011716.2688.bug-bash@gnu.org>
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

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web