Hyper-V: connecting virtual machines through a named pipe is losing data

We are trying to connect two Hyper-V virtual machines through a serial port. Hyper-V provides the serial port as a named pipe for the host system and implements the end of the named pipe server. Therefore, to connect them, we need to write a named-pipe client that connects to both virtual machines and copies the data back and forth.

We wrote such an application . Unfortunately, this application is losing data .

If we connect two hypertherms and have their exchange data, the transmission sometimes succeeds, but in many cases the receiving side reports errors or transmits only deadlocks. Similarly, if we use a link to launch the kernel debugger, it also hangs often.

What could be causing data loss? What precautions should you take when connecting named pipes this way?

Change We worked on the problem using kdsrv.exe . The debuggee COM port continues to be displayed through the named pipe, however the end of the debugger is negotiating with kdserv over TCP.

+7
source share
3 answers

Data loss is not associated with named pipes. These are Infact COM ports (emulated and physical) that can lose data because they work with a small buffer in UART.

The named pipe receives all the data that is written to the COM port. Your program reads data from the named pipe and writes it to another named pipe. In this case, data loss can occur if you write too quickly the received UART COM port, which can overflow, which leads to data loss.

You may need to add some delay to avoid exceeding the transfer rate expected by the receiving side.

In addition, you are missing ResetEvent() calls in your program.

For your problems with KD, you may need to add resets=0 to the connection string.

+1
source

I did not try to connect the VM via Serial, but I connected the VM and Host via usb (via the network) and this works. If your software needs to establish a serial connection, try testing through serial emulators with work through tcp \ ip.

0
source

I think Johnโ€™s suggestion is true: if you use a slow CPU to emulate TWO VM, then the guest OS drivers for the serial port deviate greatly from the high-speed version. So Johnโ€™s suggestion is to set the input / output side of the serial channel to the slowest possible speed. That is, you cannot use high bit rate for serial communication between VMs. Instead, you need to use the slowest speed possible, and so that the VM guest machine driver takes this hint and uses the slower version of the driver. But your physical machine must have sufficient processor speed for the simultaneous operation of two virtual machines in order to avoid the "emulation drift" of the serial driver.

Well, just my hunch, but there is a version of your virtual version, apparently there are no problems:

http://bodocsi.net/2011/02/how-setup-serial-port-link-in-virtualbox-between-two-guest-virtual-machine-in-linux/

But the following BigBox for VirtualBox describes a lot in common with your problem:

https://www.virtualbox.org/ticket/1548

And reading the end seems to indicate that the solution is related to VirtualBox's internal source code. Perhaps this is a Hyper-V issue?

0
source

All Articles