Skip to content

Commit e8d5f12

Browse files
RaitoBezariuspuckipedia
authored andcommitted
fix(cloud-hypervisor/vsock): apply a workaround for notify sockets
Since systemd/systemd@13b67b6 systemd shutdown the write end of one end of the VSOCK. cloud-hypervisor virtio-sock code does not handle well partial shutdown of the stream. socat `-T` flag can serve as a workaround to mask this bug. > Total inactivity timeout: when socat is already in the transfer loop and > nothing has happened for <timeout> [timeval] seconds (no data arrived, no > interrupt occurred...) then it terminates. Useful with protocols like UDP that > cannot transfer EOF. Co-authored-by: Puck Meerburg <[email protected]> Signed-off-by: Raito Bezarius <[email protected]>
1 parent 093ef73 commit e8d5f12

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/runners/cloud-hypervisor.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ let
8989
vulkan = true;
9090
};
9191

92-
# systemd>=256 hangs at stage-2 on notifying X_SYSTEMD_HOSTNAME
93-
supportsNotifySocket =
94-
builtins.compareVersions pkgs.systemd.version "256" < 0;
92+
supportsNotifySocket = true;
9593

9694
in {
9795
inherit tapMultiQueue;
@@ -110,7 +108,9 @@ in {
110108
111109
# Start socat to forward systemd notify socket over vsock
112110
if [ -n "$NOTIFY_SOCKET" ]; then
113-
${pkgs.socat}/bin/socat UNIX-LISTEN:notify.vsock_8888,fork UNIX-SENDTO:$NOTIFY_SOCKET &
111+
# -T2 is required because cloud-hypervisor does not handle partial
112+
# shutdown of the stream, like systemd v256+ does.
113+
${pkgs.socat}/bin/socat -T2 UNIX-LISTEN:notify.vsock_8888,fork UNIX-SENDTO:$NOTIFY_SOCKET &
114114
fi
115115
'' + lib.optionalString graphics.enable ''
116116
rm -f ${graphics.socket}

0 commit comments

Comments
 (0)