bug-bash
[Top][All Lists]
Advanced

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

Changing window size via bind -x may cause bash to hang in futex() call


From: Henning Bekel
Subject: Changing window size via bind -x may cause bash to hang in futex() call
Date: Sun, 27 Feb 2011 10:26:08 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' 
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -march=x86-64 
-mtune=generic -O2 -pipe 
-DDEFAULT_PATH_VALUE='/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin'
 -DSTANDARD_UTILS_PATH='/usr/bin:/bin:/usr/sbin:/sbin' 
-DSYS_BASHRC='/etc/bash.bashrc' -DSYS_BASH_LOGOUT='/etc/bash.bash_logout'
uname output: Linux golem 2.6.37-ARCH #1 SMP PREEMPT Fri Feb 18 18:32:16 CET 
2011 x86_64 AMD Phenom(tm) II X4 955 Processor AuthenticAMD GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.2
Patch Level: 0
Release Status: release

Description: When the size of an XTerminal is changed via a keybinding
             (either by issuing an escape sequence or by an external
             program that uses xlib) then sometimes bash will simply hang
             before redrawing the prompt, not responding to C-c
             anymore. I've used strace to verify that it's not the terminal
             but indeed bash that seems to hang, apparently in a
             futex(...FUTEX_WAIT...) call.

Repeat-By:
        test script (test_resize.bash):
        
        ---snip---

        dostuff () { 
            for((i=0; i<1000; i++)) {
                echo "$i";
            }
        }
        
        bind -x '"\ea": echo -ne "\e[8;12;80t"; dostuff'
        bind -x '"\es": echo -ne "\e[8;24;80t"; dostuff'
        
        bind -x '"\ew": xdotool windowsize --usehints $WINDOWID 80 12; dostuff'
        bind -x '"\eq": xdotool windowsize --usehints $WINDOWID 80 24; dostuff'
        
        toggle_size_fast () {
            while :; do
                echo -ne "\e[8;12;80t"
                echo -ne "\e[8;24;80t"
            done
        }
        
        ---snip---

        $ strace -o strace.log bash --rcfile test_resize.bash

        When I use either M-a/M-s to toggle the size via escape
        sequences or M-q/M-w to toggle using xdotool the freeze will
        eventually occur after a few times. The dostuff() part makes
        it appear sooner, but it also happens without it (it is harder
        to trigger it in that case, though). This happens regardless
        of whether checkwinsize is set or not.

        When I run toogle_size_fast, I get a lot of interrupted system
        call messages, but the resizing happens alright, bash never
        hangs and C-c exits the function as usual.

        I've tested this in xterm, urxvt and lilyterm (vte-based),
        with both bash 4.2.0 and bash 4.1.9.

        This is the strace output of a hang triggered by M-q:

read(0, "\33", 1)                       = 1
read(0, "q", 1)                         = 1
write(2, "\r\33[K", 4)                  = 4
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0
pipe([3, 4])                            = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, 
child_tidptr=0x7fec5c96c9d0) = 1255
setpgid(1255, 1255)                     = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
close(3)                                = 0
close(4)                                = 0
ioctl(255, TIOCGPGRP, [1255])           = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WSTOPPED|WCONTINUED, NULL) = 
1255
rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [CHLD], 8) = 0
ioctl(255, TIOCSPGRP, [1065])           = 0
rt_sigprocmask(SIG_SETMASK, [CHLD], NULL, 8) = 0
ioctl(255, SNDCTL_TMR_TIMEBASE or TCGETS, {B4000000 opost isig -icanon -echo 
...}) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
wait4(-1, 0x7fffb9e736dc, WNOHANG|WSTOPPED|WCONTINUED, NULL) = -1 ECHILD (No 
child processes)
rt_sigreturn(0xffffffffffffffff)        = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
--- SIGWINCH (Window changed) @ 0 (0) ---
ioctl(0, TIOCGWINSZ, {ws_row=24, ws_col=80, ws_xpixel=640, ws_ypixel=336}) = 0
mmap(NULL, 134217728, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 
0) = 0x7fec537e7000
munmap(0x7fec537e7000, 8491008)         = 0
munmap(0x7fec58000000, 58617856)        = 0
mprotect(0x7fec54000000, 135168, PROT_READ|PROT_WRITE) = 0
futex(0x7fec5c0d8ea0, FUTEX_WAIT, 2, NULL) = ? ERESTARTSYS (To be restarted)
--- SIGINT (Interrupt) @ 0 (0) ---
rt_sigreturn(0x2)                       = -1 EINTR (Interrupted system call)
futex(0x7fec5c0d8ea0, FUTEX_WAIT, 2, NULL




reply via email to

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