[lxc-devel] update from LXC 1.1.5 to 2.0.7: command hangs

Thomas Jarosch thomas.jarosch at intra2net.com
Wed Feb 1 10:23:35 UTC 2017


Hey there,

after updating from LXC 1.1.5 to 2.0.7, I found a little regression:
A command executed via lxc-attach suddenly hangs.

I've minimized the test case for a container named "amavisd" to this:

#################
cat > lxc_hang.sh << EOF
/usr/bin/timeout 5s /usr/bin/lxc-attach -n amavisd -- /bin/true
EOF
chmod a+rx lxc_hang.sh

# works - executed directly
/usr/bin/timeout 5s /usr/bin/lxc-attach -n amavisd -- /bin/true

# hangs until timeout
./lxc_hang.sh
#################

Removing the "timeout 5s" helps.
Also running "timeout --foreground 5s" works.
(--foreground is a TTY related cmdline switch)

strace output when the error occurs:
--------------------------
[pid 24187 is lxc-attach]
24187 open("/dev/tty", O_RDWR|O_CREAT|O_APPEND|O_CLOEXEC, 0600) = 5
24187 getuid32()                        = 0
24187 ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
24187 rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
24187 signalfd4(-1, [WINCH], 8, 0)      = 6
24187 ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
24187 ioctl(5, TIOCGWINSZ, {ws_row=41, ws_col=112, ws_xpixel=0, ws_ypixel=0}) = 0
24187 ioctl(3, TIOCSWINSZ, {ws_row=41, ws_col=112, ws_xpixel=0, ws_ypixel=0}) = 0
24187 ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
24187 ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0

24187 ioctl(5, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 -opost -isig -icanon -echo ...}) = ? ERESTARTSYS (To be r
24187 --- SIGTTOU (Stopped (tty output)) @ 0 (0) ---
24187 --- SIGTTOU (Stopped (tty output)) @ 0 (0) ---
24187 ioctl(5, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 -opost -isig -icanon -echo ...}) = ? ERESTARTSYS (To be r
24187 --- SIGTTOU (Stopped (tty output)) @ 0 (0) ---
24187 --- SIGTTOU (Stopped (tty output)) @ 0 (0) ---
24187 ioctl(5, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 -opost -isig -icanon -echo ...}) = ? ERESTARTSYS (To be r
24187 --- SIGTTOU (Stopped (tty output)) @ 0 (0) ---
24187 --- SIGTTOU (Stopped (tty output)) @ 0 (0) ---
24187 ioctl(5, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 -opost -isig -icanon -echo ...}) = ? ERESTARTSYS (To be r
24187 --- SIGTTOU (Stopped (tty output)) @ 0 (0) ---
24187 --- SIGTTOU (Stopped (tty output)) @ 0 (0) ---
..endless loop..
--------------------------


strace output when invoked directly from the shell:
--------------------------
24478 open("/dev/tty", O_RDWR|O_CREAT|O_APPEND|O_CLOEXEC, 0600) = 5
24478 getuid32()                        = 0
24478 ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
24478 rt_sigprocmask(SIG_BLOCK, [WINCH], [], 8) = 0
24478 signalfd4(-1, [WINCH], 8, 0)      = 6
24478 ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
24478 ioctl(5, TIOCGWINSZ, {ws_row=41, ws_col=112, ws_xpixel=0, ws_ypixel=0}) = 0
24478 ioctl(3, TIOCSWINSZ, {ws_row=41, ws_col=112, ws_xpixel=0, ws_ypixel=0}) = 0
24478 ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
24478 ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
24478 ioctl(5, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 -opost -isig -icanon -echo ...}) = 0
24478 geteuid32()                       = 0
..continues fine..
--------------------------


Also the strace output of "lxc-attach" from 1.1.5 doesn't
show any TTY related "initializations". So it's probably a new code path.


Any idea what could be wrong?
Can anyone else reproduce this problem?

Tested on kernel 3.14.79 / glibc 2.17. I've also tried previous
LXC versions like 2.0.3 and 2.0.1, same behaviour.

Cheers,
Thomas



More information about the lxc-devel mailing list