Bug 1920337 - virt-qemu-run hang if starting qemu process failed
Summary: virt-qemu-run hang if starting qemu process failed
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.4
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: 8.4
Assignee: Michal Privoznik
QA Contact: yafu
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-26 06:13 UTC by yafu
Modified: 2021-11-16 08:08 UTC (History)
7 users (show)

Fixed In Version: libvirt-7.3.0-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-16 07:51:32 UTC
Type: Bug
Target Upstream Version: 7.2.0
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:4684 0 None None None 2021-11-16 07:51:58 UTC

Description yafu 2021-01-26 06:13:01 UTC
Description of problem:
virt-qemu-run hang if starting qemu process failed

Version-Release number of selected component (if applicable):
libvirt-daemon-7.0.0-2.module+el8.4.0+9520+ef609c5f.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Start a qemu process with enforcing mode selinux policy(see https://bugzilla.redhat.com/show_bug.cgi?id=1772943#c7):
# virt-qemu-run -v -d /root/vm2.xml 
virt-qemu-run: 32: initializing libvirt 4348
virt-qemu-run: 1790: initializing signal handlers
virt-qemu-run: 1888: preparing event loop thread
virt-qemu-run: 1973: opening qemu:///embed?root=/tmp/virt-qemu-run-2MRIX0
virt-qemu-run: 32725: fetching guest config /root/vm2.xml
virt-qemu-run: 32761: starting guest /root/vm2.xml
virt-qemu-run: cannot start VM: can't connect to virtlogd: Cannot recv data: Connection reset by peer


2.After step1, virt-qemu-run did not exit and also can not terminate by 'ctrl-c';

3.After step2, check the virt-qemu-run process:
# ps aux | grep -i virt-qemu-run
root        4348  0.0  0.0 550184 25580 pts/0    Tl   00:51   0:00 virt-qemu-run -v -d /root/vm2.xml

4.The backtrace of virt-qemu-run:
(gdb) t a a bt

Thread 2 (Thread 0x7f1738dd7700 (LWP 4349)):
#0  0x00007f174dd35a31 in __GI___poll (fds=0x563311e9a3a0, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f174e26eab6 in g_main_context_poll (priority=<optimized out>, n_fds=2, fds=0x563311e9a3a0, timeout=<optimized out>, context=0x563311e9a2e0) at gmain.c:4203
#2  0x00007f174e26eab6 in g_main_context_iterate (context=context@entry=0x563311e9a2e0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
    at gmain.c:3897
#3  0x00007f174e26ebe0 in g_main_context_iteration (context=0x563311e9a2e0, may_block=1) at gmain.c:3963
#4  0x00007f174e60d134 in virEventGLibRunOnce () at /lib64/libvirt.so.0
#5  0x0000563310d67cbd in qemuShimEventLoop ()
#6  0x00007f174e296e1a in g_thread_proxy (data=0x563311e96400) at gthread.c:784
#7  0x00007f174ad6214a in start_thread (arg=<optimized out>) at pthread_create.c:479
#8  0x00007f174dd40db3 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7f174eda2fc0 (LWP 4348)):
#0  0x00007f174ad6363d in __GI___pthread_timedjoin_ex (threadid=139737715013376, thread_return=thread_return@entry=0x0, abstime=abstime@entry=0x0, block=block@entry=true)
    at pthread_join_common.c:89
#1  0x00007f174ad63450 in __pthread_join (threadid=<optimized out>, thread_return=thread_return@entry=0x0) at pthread_join.c:24
#2  0x00007f174e2b59bb in g_system_thread_wait (thread=0x563311e96400) at gthread-posix.c:1219
#3  0x00007f174e2972ae in g_thread_join (thread=0x563311e96400) at gthread.c:952
#4  0x0000563310d67319 in main ()

Actual results:
virt-qemu-run hang if starting qemu process failed

Expected results:
virt-qemu-run should exit if starting qemu process failed

Additional info:

Comment 1 Michal Privoznik 2021-03-01 11:51:43 UTC
Patches posted upstream:

https://listman.redhat.com/archives/libvir-list/2021-March/msg00010.html

Comment 3 Michal Privoznik 2021-03-12 16:09:46 UTC
Merged upstream:

52a937d8a2 qemu_shim: Don't hang if failed to start domain

v7.1.0-202-g52a937d8a2

Comment 6 yafu 2021-05-27 01:46:15 UTC
Verifeid with libvirt-daemon-7.3.0-1.module+el8.5.0+11004+f4810536.x86_64.

Test steps:
1.Start a qemu process with enforcing mode selinux policy(see https://bugzilla.redhat.com/show_bug.cgi?id=1772943#c7), process exited successfully after failed to start:
# virt-qemu-run -d -v /root/vm1.xml 
virt-qemu-run: 31: initializing libvirt 104942
virt-qemu-run: 2603: initializing signal handlers
virt-qemu-run: 2891: preparing event loop thread
virt-qemu-run: 2989: opening qemu:///embed?root=%2Ftmp%2Fvirt-qemu-run-JRNW30
virt-qemu-run: 36677: fetching guest config /root/vm1.xml
virt-qemu-run: 36820: starting guest /root/vm1.xml
virt-qemu-run: cannot start VM: can't connect to virtlogd: Cannot recv data: Connection reset by peer
virt-qemu-run: 618467: cleaned up, exiting

Comment 8 errata-xmlrpc 2021-11-16 07:51:32 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 (virt:av bug fix and enhancement update), and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHBA-2021:4684


Note You need to log in before you can comment on or make changes to this bug.