Skip to content

Commit 1fd3911

Browse files
jlebondustymabe
authored andcommitted
cmdlib.sh: feed /dev/zero as qemu stdin
This is a follow-up to 79b15c8 ("cmdlib.sh: go back to using `tail -F` for command output") which was subsequently reverted. To summarize, it seems like in QEMU v8.2 (in f40), the guest sometimes would hang when writing over virtio-serial if the device is hooked up to the QEMU's stdio. In testing, removing the `<&-` hack to close QEMU's stdin fixed it for CoreOS CI but not Prow: #3785 (comment) I think I've narrowed it down to CoreOS CI (i.e. Jenkins) allocating a tty and Prow not. When stdin is not a tty, QEMU would immediately gets EOF if it tries to read anything. I'm not sure exactly what happens, but I think the virtio-serial hang is linked to this (even though there's no userspace code in the guest trying to read from the virtio-serial port). Work around this by explicitly feeding `/dev/zero` to QEMU's stdin. (cherry picked from commit bb60451)
1 parent b9336c0 commit 1fd3911

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/cmdlib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ EOF
823823
if ! "${kola_args[@]}" -- "${base_qemu_args[@]}" \
824824
-device virtserialport,chardev=virtioserial0,name=cosa-cmdout \
825825
-chardev stdio,id=virtioserial0 \
826-
"${qemu_args[@]}" <&-; then # the <&- here closes stdin otherwise qemu waits forever
826+
"${qemu_args[@]}" < /dev/zero; then # qemu hangs if it has nothing to read on stdin
827827
cat "${runvm_console}"
828828
fatal "Failed to run 'kola qemuexec'"
829829
fi

src/secex-genprotimgvm-scripts/runvm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ else
5656
fi
5757

5858
if ! "${kola_args[@]}" -- "${base_qemu_args[@]}" \
59-
"${qemu_args[@]}" <&-; then # the <&- here closes stdin otherwise qemu waits forever
59+
"${qemu_args[@]}" < /dev/zero; then # qemu hangs if it has nothing to read on stdin
6060
cat "${runvm_console}"
6161
echo "Failed to run 'kola qemuexec'"
6262
exit 1

0 commit comments

Comments
 (0)