Virsh hangs/blocks if ran in background
Software environment
- Operating system: Rocky 8.6
- Architecture: x86_64
- kernel version: 4.18.0
- libvirt version: 8.0.0, package: 5.2.module+el8.6.0+998+252a5635
- Hypervisor and version: QEMU 6.2.0
Description of problem
virsh hangs if it is executed in the background/if the process is forked. We hit this issue when executing virsh from a script. On earlier version of virsh (libvirt version: 6.0.0, package: 37.module+el8.5.0+670+c4aa478c) this worked without issue.
Steps to reproduce
- ssh in to linux machine with a bash-like shell
- Run
virsh list &
- This will block/hang the process.
Additional information
Process output
root 5427 0.0 0.0 138072 5280 ? S 16:41 0:00 \_ sshd: root@pts/1
root 5428 0.0 0.0 15636 4396 pts/1 Ss 16:41 0:00 \_ -bash
root 7366 0.0 0.0 239500 16052 pts/1 Tl 17:03 0:00 \_ virsh list
root 7368 0.0 0.0 310360 8260 pts/1 Tl 17:03 0:00 | \_ /usr/bin/pkttyagent --process 7366 --notify-fd 4 --fallback
# strace -p 7366
strace: Process 7366 attached
--- stopped by SIGTTOU ---
I can send a kill -SIGCONT
to the process, which will terminate the process without the output.
My understanding of the inner workings of libvirt is limited, but it might be related to this thread? https://listman.redhat.com/archives/libvir-list/2021-December/226188.html
Please let me know if you want me to provide any additional information.