Bug 1025269

Summary: libguestfs tests hang in libguestfs-1.20.11/tests/guests/guest-aux/make-fedora-img.pl
Product: Red Hat Enterprise Linux 6 Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Pino Toscano <ptoscano>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5CC: leiwang, mbooth, pbrady, ptoscano, rjones, wshi
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libguestfs-1.20.11-3.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-14 06:34:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 910269    
Attachments:
Description Flags
strace.log
none
run
none
test.c none

Description Richard W.M. Jones 2013-10-31 10:56:12 UTC
Description of problem:

Rebuilding the libguestfs RPM in RHEL 6.5 hangs when building
the test Fedora image.

Libguestfs runs:
/usr/libexec/qemu-kvm -nographic -machine accel=kvm:tcg -device \?

and this command hangs, but also causes the parent process to
be killed with SIGSTOP(!)

19995 pts/0    T      0:00 /usr/bin/perl /home/rjones/d/rhel/libguestfs/rhel-6.5/libguestfs-1.20.11/tests/guests/guest-aux/make-fedora-img.pl
20006 pts/0    T      0:00 /usr/libexec/qemu-kvm -nographic -machine accel=kvm:tcg -device ?


Version-Release number of selected component (if applicable):

libguestfs 1.20.11-2.el6

How reproducible:

100% on two different machines

Steps to Reproduce:
1. Update to RHEL 6.5 nightly (20131030)
2. rhpkg local

Comment 2 Richard W.M. Jones 2013-10-31 12:23:44 UTC
Created attachment 817864 [details]
strace.log

strace -f make check -C tests/guests

Compressed file -- this file expands to 239 MB (sic!)

The important part is that it's stopping while writing to
the console, ie:

21593 --- SIGTTOU (Stopped (tty output)) @ 0 (0) ---

I have no idea why this happens in RHEL 6.5 but not anywhere else.

Comment 3 bfan 2013-10-31 12:36:40 UTC
reproduced, 

# rpmbuild --rebuild --target=x86_64 libguestfs-1.20.11-2.el6.src.rpm

( omit message ...)
SRCDIR=. ../../run --test guest-aux/make-debian-img.sh
7 seconds: guest-aux/make-debian-img.sh
debian.img: file size bytes: 536870912
debian.img: allocated bytes: 14405632
debian.img: MD5 hash:        acae590ee7f33d5cfd904ca07db0b65d
SRCDIR=. LAYOUT=partitions ../../run --test guest-aux/make-fedora-img.pl

(it hangs here)


It blocks errata tps-srpmtest, please help to fix ASAP

Comment 4 Richard W.M. Jones 2013-10-31 20:10:09 UTC
I believe this is a bug in coreutils 'timeout' utility, in fact
one which is still present upstream.

I will upload two attachments which demonstrate the bug:

$ gcc -Wall test.c -o test
$ ./test
$ timeout 4h ./test
$ ./run
<-- this command hangs with ./test putting itself into STOPPED state

The following patch to coreutils fixes the problem for me.

--- coreutils-8.21/src/timeout.c.old	2013-10-31 19:44:01.719755435 +0000
+++ coreutils-8.21/src/timeout.c	2013-10-31 19:50:07.634292913 +0000
@@ -443,9 +443,11 @@
     {                           /* child */
       int exit_status;
 
+#if 0
       /* exec doesn't reset SIG_IGN -> SIG_DFL.  */
       signal (SIGTTIN, SIG_DFL);
       signal (SIGTTOU, SIG_DFL);
+#endif
 
       execvp (argv[0], argv);   /* FIXME: should we use "sh -c" ... here?  */

Comment 5 Richard W.M. Jones 2013-10-31 20:11:08 UTC
Created attachment 818048 [details]
run

Comment 6 Richard W.M. Jones 2013-10-31 20:11:43 UTC
Created attachment 818049 [details]
test.c

Comment 7 Ondrej Vasik 2013-11-01 12:24:31 UTC
Just disabling the code path is probably not correct way ;) ... however, it should at least be investigated - I don't think that priority urgent is the right one, though - as this should be "workaroundable" somehow in the test itself.

Comment 8 Ondrej Vasik 2013-11-01 12:29:30 UTC
I see it tracked on upstream tracker already - http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15779 ... thanks Richard!

Comment 9 Richard W.M. Jones 2013-11-01 14:49:35 UTC
Workaround in libguestfs:
commit 7113aee0b439b411602d8d7d4b03bf02bc91b800

Comment 10 Richard W.M. Jones 2013-12-18 19:54:28 UTC
I'm also seeing this on Fedora 19.

Comment 11 Pádraig Brady 2013-12-19 02:05:49 UTC
timeout has the --foreground option on fedora 19

Comment 12 Richard W.M. Jones 2014-01-28 21:11:21 UTC
Hoping we've fixed it properly (in libguestfs) this time:

https://github.com/libguestfs/libguestfs/commit/e3f72805d108c601280b889692c47d7d825e6079

Comment 14 bfan 2014-05-14 09:14:55 UTC
Verified with libguestfs-1.20.11-3.el6,

Build passed

Comment 15 errata-xmlrpc 2014-10-14 06:34:54 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1458.html