bug-bash
[Top][All Lists]
Advanced

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

Re: [bug-bash] Named fifo's causing hanging bash scripts


From: Dr. Werner Fink
Subject: Re: [bug-bash] Named fifo's causing hanging bash scripts
Date: Tue, 13 Jan 2015 10:29:40 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Jan 12, 2015 at 11:50:56AM -0500, Chet Ramey wrote:
> On 1/12/15 9:55 AM, werner@linux-8jdz.site wrote:
> > Configuration Information [Automatically generated, do not change]:
> > Machine: x86_64
> > OS: linux-gnu
> > Compiler: gcc -I/home/abuild/rpmbuild/BUILD/bash-4.3 
> > -L/home/abuild/rpmbuild/BUILD/bash-4.3/../readline-6.3
> > Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
> > -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-suse-linux-gnu' 
> > -DCONF_VENDOR='suse' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' 
> > -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -fmessage-length=0 
> > -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector 
> > -funwind-tables -fasynchronous-unwind-tables -g  -D_GNU_SOURCE 
> > -DRECYCLES_PIDS -Wall -g -Wuninitialized -Wextra -Wno-unprototyped-calls 
> > -Wno-switch-enum -Wno-unused-variable -Wno-unused-parameter 
> > -Wno-parentheses -ftree-loop-linear -pipe -DBNC382214=0 
> > -DMUST_UNBLOCK_CHLD=1 -DIMPORT_FUNCTIONS_DEF=0 -fprofile-use
> > uname output: Linux d136 3.15.0-rc7-3-desktop #1 SMP PREEMPT Wed May 28 
> > 15:39:51 UTC 2014 (96f5b60) x86_64 x86_64 x86_64 GNU/Linux
> > Machine Type: x86_64-suse-linux-gnu
> > 
> > Bash Version: 4.3
> > Patch Level: 33
> > Release Status: release
> > 
> > Description:
> >         Named fifo's causing hanging bash scripts like
> > 
> >         while IFS="|" read a b c ; do
> >           [shell code]
> >         done < <(shell code)
> > 
> >         can cause random hangs of the bash.    An strace shows that the bash
> >         stays in wait4()
> 
> And when you attach to one of the hanging bash processes using gdb, what
> does the stack traceback look like?

Yes (and sorry for the wrong email address as this was done on a clean virtual 
sysstem)

there are two hanging bash processes together with the find command:

werner   19062  0.8  0.0  11864  2868 ttyS0    S+   10:21   0:00 bash -x 
/tmp/brp-25-symlink
werner   19063  0.0  0.0  11860  1920 ttyS0    S+   10:21   0:00 bash -x 
/tmp/brp-25-symlink
werner   19064  0.2  0.0  16684  2516 ttyS0    S+   10:21   0:00 find . -type l 
-printf %p|%h|%l n

the gdb -p 19062 and gdb -p 19063 show

(gdb) bt
#0  0x00007f530818a65c in waitpid () from /lib64/libc.so.6
#1  0x000000000042b233 in waitchld (block=block@entry=1, wpid=19175) at 
jobs.c:3235
#2  0x000000000042c6da in wait_for (pid=pid@entry=19175) at jobs.c:2496
#3  0x00000000004302e1 in command_substitute (string=string@entry=0x22ccd80 
"dirname_int $link", 
    quoted=quoted@entry=1) at subst.c:5534
#4  0x00000000004704db in param_expand (string=string@entry=0x22cc8d0 
"$(dirname_int $link)", 
    sindex=sindex@entry=0x7fff39f90ef0, quoted=quoted@entry=1, 
expanded_something=expanded_something@entry=0x0, 
    contains_dollar_at=contains_dollar_at@entry=0x7fff39f90f20, 
    quoted_dollar_at_p=quoted_dollar_at_p@entry=0x7fff39f90f00, 
    had_quoted_null_p=had_quoted_null_p@entry=0x7fff39f90f10, pflags=0) at 
subst.c:7970
#5  0x0000000000471123 in expand_word_internal (word=word@entry=0x22cc1a0, 
quoted=quoted@entry=1, 
    isexp=isexp@entry=0, 
contains_dollar_at=contains_dollar_at@entry=0x7fff39f91080, 
    expanded_something=expanded_something@entry=0x0) at subst.c:8393
#6  0x000000000047130f in expand_word_internal (word=word@entry=0x7fff39f91120, 
quoted=quoted@entry=0, 
    isexp=isexp@entry=0, contains_dollar_at=contains_dollar_at@entry=0x0, 
    expanded_something=expanded_something@entry=0x0) at subst.c:8548
#7  0x0000000000472daf in call_expand_word_internal (e=0x0, c=0x0, i=0, q=0, 
w=0x7fff39f91120) at subst.c:3299
#8  expand_string_assignment (string=string@entry=0x22cb159 "\"$(dirname_int 
$link)\"", quoted=quoted@entry=0)
    at subst.c:3387
#9  0x0000000000473110 in expand_string_if_necessary (string=<optimized out>, 
    string@entry=0x22cb159 "\"$(dirname_int $link)\"", quoted=quoted@entry=0, 
    func=func@entry=0x472d50 <expand_string_assignment>) at subst.c:3092
#10 0x0000000000473349 in do_assignment_internal (word=0x22cbbe0, expand=1) at 
subst.c:2823
#11 0x000000000047776a in do_word_assignment (flags=<optimized out>, 
word=<optimized out>) at subst.c:2912
#12 expand_word_list_internal (eflags=<optimized out>, list=<optimized out>) at 
subst.c:9669
#13 expand_words (list=0xffffffffffffffff) at subst.c:9280
#14 0x0000000000461093 in execute_simple_command (simple_command=0x22c1ed0, 
pipe_in=pipe_in@entry=-1, 
    pipe_out=pipe_out@entry=-1, async=async@entry=0, 
fds_to_close=fds_to_close@entry=0x22ccce0)
    at execute_cmd.c:4001
#15 0x00000000004629fc in execute_command_internal (command=0x22bc9e0, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22ccce0)
    at execute_cmd.c:788
#16 0x0000000000462ba6 in execute_connection (fds_to_close=0x22ccce0, 
pipe_out=-1, pipe_in=-1, asynchronous=0, 
    command=0x22c0bd0) at execute_cmd.c:2497
#17 execute_command_internal (command=command@entry=0x22c0bd0, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22ccce0)
    at execute_cmd.c:946
#18 0x0000000000464d41 in execute_command (command=0x22c0bd0) at 
execute_cmd.c:391
#19 0x0000000000462b6a in execute_connection (fds_to_close=0x22cbf90, 
pipe_out=-1, pipe_in=-1, asynchronous=0, 
    command=0x22c2500) at execute_cmd.c:2495
#20 execute_command_internal (command=command@entry=0x22c2500, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22cbf90)
    at execute_cmd.c:946
#21 0x0000000000464d41 in execute_command (command=0x22c2500) at 
execute_cmd.c:391
#22 0x0000000000462b6a in execute_connection (fds_to_close=0x22c9d90, 
pipe_out=-1, pipe_in=-1, asynchronous=0, 
    command=0x22c2680) at execute_cmd.c:2495
#23 execute_command_internal (command=command@entry=0x22c2680, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22c9d90)
    at execute_cmd.c:946
#24 0x0000000000464d41 in execute_command (command=0x22c2680) at 
execute_cmd.c:391
#25 0x0000000000462b6a in execute_connection (fds_to_close=0x22c0770, 
pipe_out=-1, pipe_in=-1, asynchronous=0, 
---Type <return> to continue, or q <return> to quit---
    command=0x22c27a0) at execute_cmd.c:2495
#26 execute_command_internal (command=command@entry=0x22c27a0, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22c0770)
    at execute_cmd.c:946
#27 0x0000000000464d41 in execute_command (command=0x22c27a0) at 
execute_cmd.c:391
#28 0x0000000000462b6a in execute_connection (fds_to_close=0x22c06e0, 
pipe_out=-1, pipe_in=-1, asynchronous=0, 
    command=0x22c28c0) at execute_cmd.c:2495
#29 execute_command_internal (command=command@entry=0x22c28c0, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22c06e0)
    at execute_cmd.c:946
#30 0x0000000000464d41 in execute_command (command=0x22c28c0) at 
execute_cmd.c:391
#31 0x0000000000462b6a in execute_connection (fds_to_close=0x22c0560, 
pipe_out=-1, pipe_in=-1, asynchronous=0, 
    command=0x22c29e0) at execute_cmd.c:2495
#32 execute_command_internal (command=command@entry=0x22c29e0, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22c0560)
    at execute_cmd.c:946
#33 0x0000000000464d41 in execute_command (command=0x22c29e0) at 
execute_cmd.c:391
#34 0x0000000000462b6a in execute_connection (fds_to_close=0x22c9d30, 
pipe_out=-1, pipe_in=-1, asynchronous=0, 
    command=0x22c2ae0) at execute_cmd.c:2495
#35 execute_command_internal (command=command@entry=0x22c2ae0, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22c9d30)
    at execute_cmd.c:946
#36 0x0000000000464d41 in execute_command (command=0x22c2ae0) at 
execute_cmd.c:391
#37 0x0000000000462b6a in execute_connection (fds_to_close=0x22cc3f0, 
pipe_out=-1, pipe_in=-1, asynchronous=0, 
    command=0x22c38b0) at execute_cmd.c:2495
#38 execute_command_internal (command=command@entry=0x22c38b0, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22cc3f0)
    at execute_cmd.c:946
#39 0x0000000000464d41 in execute_command (command=0x22c38b0) at 
execute_cmd.c:391
#40 0x0000000000462b6a in execute_connection (fds_to_close=0x22c03e0, 
pipe_out=-1, pipe_in=-1, asynchronous=0, 
    command=0x22c3de0) at execute_cmd.c:2495
#41 execute_command_internal (command=command@entry=0x22c3de0, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22c03e0)
    at execute_cmd.c:946
#42 0x0000000000464d41 in execute_command (command=0x22c3de0) at 
execute_cmd.c:391
#43 0x0000000000462b6a in execute_connection (fds_to_close=0x22ca230, 
pipe_out=-1, pipe_in=-1, asynchronous=0, 
    command=0x22c5c90) at execute_cmd.c:2495
#44 execute_command_internal (command=command@entry=0x22c5c90, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22ca230)
    at execute_cmd.c:946
#45 0x0000000000464d41 in execute_command (command=0x22c5c90) at 
execute_cmd.c:391
#46 0x0000000000462b6a in execute_connection (fds_to_close=0x22b93f0, 
pipe_out=-1, pipe_in=-1, asynchronous=0, 
    command=0x22c5da0) at execute_cmd.c:2495
#47 execute_command_internal (command=command@entry=0x22c5da0, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22b93f0)
    at execute_cmd.c:946
#48 0x0000000000464d41 in execute_command (command=0x22c5da0) at 
execute_cmd.c:391
#49 0x0000000000462b6a in execute_connection (fds_to_close=0x22c5360, 
pipe_out=-1, pipe_in=-1, asynchronous=0, 
    command=0x22c6440) at execute_cmd.c:2495
#50 execute_command_internal (command=command@entry=0x22c6440, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22c5360)
---Type <return> to continue, or q <return> to quit---
    at execute_cmd.c:946
#51 0x0000000000464d41 in execute_command (command=0x22c6440) at 
execute_cmd.c:391
#52 0x0000000000462b6a in execute_connection (fds_to_close=0x22cd1d0, 
pipe_out=-1, pipe_in=-1, asynchronous=0, 
    command=0x22c6540) at execute_cmd.c:2495
#53 execute_command_internal (command=command@entry=0x22c6540, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22cd1d0)
    at execute_cmd.c:946
#54 0x0000000000464d41 in execute_command (command=0x22c6540) at 
execute_cmd.c:391
#55 0x0000000000462b6a in execute_connection (fds_to_close=0x22c0580, 
pipe_out=-1, pipe_in=-1, asynchronous=0, 
    command=0x22c9770) at execute_cmd.c:2495
#56 execute_command_internal (command=command@entry=0x22c9770, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22c0580)
    at execute_cmd.c:946
#57 0x0000000000464d41 in execute_command (command=0x22c9770) at 
execute_cmd.c:391
#58 0x0000000000462b6a in execute_connection (fds_to_close=0x22bbf10, 
pipe_out=-1, pipe_in=-1, asynchronous=0, 
    command=0x22c9cd0) at execute_cmd.c:2495
#59 execute_command_internal (command=command@entry=0x22c9cd0, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22bbf10)
    at execute_cmd.c:946
#60 0x0000000000464d41 in execute_command (command=0x22c9cd0) at 
execute_cmd.c:391
#61 0x0000000000425367 in execute_while_or_until (while_command=0x22c9c20, 
type=type@entry=0)
    at execute_cmd.c:3380
#62 0x0000000000464a2e in execute_while_command (while_command=<optimized out>) 
at execute_cmd.c:3326
#63 execute_command_internal (command=command@entry=0x22c9d00, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22c9e30)
    at execute_cmd.c:886
#64 0x0000000000464d41 in execute_command (command=0x22c9d00) at 
execute_cmd.c:391
#65 0x000000000041cabe in reader_loop () at eval.c:160
#66 0x000000000041c793 in main (argc=3, argv=0x7fff39f92778, 
env=0x7fff39f92798) at shell.c:757

(gdb) bt
#0  0x00007f530818a65c in waitpid () from /lib64/libc.so.6
#1  0x000000000042b233 in waitchld (block=block@entry=1, wpid=19064) at 
jobs.c:3235
#2  0x000000000042c6da in wait_for (pid=19064) at jobs.c:2496
#3  0x0000000000464339 in execute_command_internal (command=0x22ca360, 
asynchronous=asynchronous@entry=0, 
    pipe_in=pipe_in@entry=-1, pipe_out=pipe_out@entry=-1, 
fds_to_close=fds_to_close@entry=0x22ca5f0)
    at execute_cmd.c:830
#4  0x00000000004860c2 in parse_and_execute (
    string=string@entry=0x22ca4f0 "find . -type l -printf '%p|%h|%l\\n' 
2>/dev/null", 
    from_file=from_file@entry=0x48b347 "process substitution", 
flags=flags@entry=5) at evalstring.c:388
#5  0x00000000004728d4 in process_substitute (open_for_read_in_child=0, 
    string=0x22ca4f0 "find . -type l -printf '%p|%h|%l\\n' 2>/dev/null") at 
subst.c:5214
#6  expand_word_internal (word=<optimized out>, quoted=quoted@entry=0, 
isexp=isexp@entry=0, 
    contains_dollar_at=contains_dollar_at@entry=0x7fff39f92260, 
    expanded_something=expanded_something@entry=0x7fff39f92250) at subst.c:8273
#7  0x00000000004737db in shell_expand_word_list (tlist=0x22c9f80, 
eflags=<optimized out>) at subst.c:9581
#8  0x0000000000477abe in expand_word_list_internal (eflags=<optimized out>, 
list=<optimized out>)
    at subst.c:9701
#9  expand_words_no_vars (list=0xffffffffffffffff, list@entry=0x22c9f20) at 
subst.c:9289
#10 0x000000000043f605 in redirection_expand (word=word@entry=0x22c9dd0) at 
redir.c:290
#11 0x000000000043f906 in do_redirection_internal 
(redirect=redirect@entry=0x22c9df0, flags=flags@entry=3)
    at redir.c:830
#12 0x000000000047b571 in do_redirections (list=<optimized out>, 
flags=flags@entry=3) at redir.c:233
#13 0x0000000000462ff9 in execute_command_internal 
(command=command@entry=0x22c9d00, 
    asynchronous=asynchronous@entry=0, pipe_in=pipe_in@entry=-1, 
pipe_out=pipe_out@entry=-1, 
    fds_to_close=fds_to_close@entry=0x22c9e30) at execute_cmd.c:723
#14 0x0000000000464d41 in execute_command (command=0x22c9d00) at 
execute_cmd.c:391
#15 0x000000000041cabe in reader_loop () at eval.c:160
#16 0x000000000041c793 in main (argc=3, argv=0x7fff39f92778, 
env=0x7fff39f92798) at shell.c:757

Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr

Attachment: signature.asc
Description: Digital signature


reply via email to

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