virtio-win / kvm-guest-drivers-windows

Windows paravirtualized drivers for QEMU\KVM
https://www.linux-kvm.org/page/WindowsGuestDrivers
BSD 3-Clause "New" or "Revised" License
2.01k stars 385 forks source link

vsock: Incorrect number of bytes of data received from vsock on Windows #1035

Open niceguy135 opened 8 months ago

niceguy135 commented 8 months ago

Describe the bug A test script is running on the host, sending bytes of data over vsock. Another application that has developed with a wrapper for working with vsock receives this data on Windows guest.

The problem is that vsok on the WIndows side reads randomly more or less data than was sent from the Linux side.

TraceView logs: LogSession0.txt

To Reproduce On Linux host run this: vsock_test.txt

On Windows guest run this: client_test.txt With this imported vsock wrapper: winSock.txt

Expected behavior Well, I kind of expect WIndows to receive exactly as many bytes over vsock as it is sent)

Screenshots

From Linux host: Linux host terminal screanshoot

From Windows guest: cmd

Host:

VM:

Additional context The problem disappears (for the current test) if you increase the buffer. But this approach to solving the problem does not seem right to me

MartinDrab commented 8 months ago

Hello,

IMHO this is a feature, not a bug. The socket is of the SOCK_STREAM; type which means that data are being sent and received as a stream of bytes. Thus, sending **N** bytes in onesendcall does not imply their reception in onerecv` call. It depends on how quickly the data are transferred between the host and the VM.

You would need a datagram (message-based) socket, however, I do not think such sockets are supported by the Socket driver at the moment.