Skip to content

Commit 3646501

Browse files
jlebonopenshift-cherrypick-robot
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 eb95a3d commit 3646501

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
@@ -816,7 +816,7 @@ EOF
816816
if ! "${kola_args[@]}" -- "${base_qemu_args[@]}" \
817817
-device virtserialport,chardev=virtioserial0,name=cosa-cmdout \
818818
-chardev stdio,id=virtioserial0 \
819-
"${qemu_args[@]}" <&-; then # the <&- here closes stdin otherwise qemu waits forever
819+
"${qemu_args[@]}" < /dev/zero; then # qemu hangs if it has nothing to read on stdin
820820
cat "${runvm_console}"
821821
fatal "Failed to run 'kola qemuexec'"
822822
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)