This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours

Bug 863754

Summary: virtio_serialport data loss when hot-unplugging and re-plugging the port (host->guest)
Product: [Fedora] Fedora Reporter: Lukas Doktor <ldoktor>
Component: virtio-winAssignee: Gal Hammer <ghammer>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: amit.shah, bcao, berrange, cfergeau, crobinso, dwmw2, ghammer, itamar, juzhang, knoel, pbonzini, rjones, scottt.tw, virt-maint, vrozenfe, yvugenfi
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-02 11:10:14 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Attachments:
Description Flags
host sender script (sends A, B, C, D..., resends when send fails)
none
guest receiver script (reads the port and verifies A, B, C, D, ... is received correctly. Reopens the port when read fails) none

Description Lukas Doktor 2012-10-07 04:31:31 EDT
Description of problem:
Hi guys,

this is bz contain the opposite direction of the same problem from:
https://bugzilla.redhat.com/show_bug.cgi?id=863753

I'm developing an interrupted loopback test. I managed to go around the problem with hot-plugging of the incorrectly uninitialized port ( https://bugzilla.redhat.com/show_bug.cgi?id=796048 ) but some data are lost between port replugs even thought the send/recv commands passed (I'm resending data in case send fails).

I created simple reproducers in pyton for each direction, this one is for host->guest (data loss or guest failure)
I'm sending data from host to guest, than I unplug the port. This usually causes qemu to fail.

Version-Release number of selected component (if applicable):
HOST:
kernel-3.5.3-1.fc17.x86_64
qemu-kvm-1.0.1-1.fc17.x86_64
GUEST:
kernel-3.5.4-2.fc17.x86_64

How reproducible:
10-20% (see the log for details)

Steps to Reproduce:
1) start sending data from host (run sender.py on host)
2) start receiving data on guest (run listener.py on guest)
3) unplug/replug the port (eg. MON=/tmp/monitor-hmp1-20121004-115412-sLj47KEF ; while :; do echo device_del vs1 | sudo socat $MON - ; sleep 5 ; echo 'device_add virtserialport,id=vs1,chardev=devvs1,nr=1,name=com.redhat.spice.0' | sudo socat $MON - ; sleep 5 ; done )
4) if VM survives see the error messages
  
Actual results:
Error messages informing about how much data were successfully sent from host, but were not received on guest.

Expected results:
send/recv should report failure for all data which were not transferred. So no data loss should be visible using the simple reproducer.
Comment 1 Lukas Doktor 2012-10-07 04:32:14 EDT
Created attachment 622917 [details]
host sender script (sends A, B, C, D..., resends when send fails)
Comment 2 Lukas Doktor 2012-10-07 04:32:59 EDT
Created attachment 622918 [details]
guest receiver script (reads the port and verifies A, B, C, D, ... is received correctly. Reopens the port when read fails)
Comment 3 Lukas Doktor 2012-10-07 04:34:45 EDT
HOST->GUEST


[10s between replug]
Opened
Closing ([Errno 19] No such device)
3
Opened
Closing ([Errno 19] No such device)
3
Opened
Closing ([Errno 19] No such device)
3
Opened
Closing ([Errno 19] No such device)
3
Opened
skipped A (waiting for B)
Closing ([Errno 19] No such device)
3
Opened
Closing ([Errno 19] No such device)
3
Opened
Closing ([Errno 19] No such device)
3
Opened
Closing ([Errno 19] No such device)
3
Opened
Closing ([Errno 19] No such device)


[5s between replug]
3
Opened
Closing ([Errno 19] No such device)
3
Opened
skipped A (waiting for B)
Closing ([Errno 19] No such device)
3
Opened
skipped 34 (waiting for 5)
Closing ([Errno 19] No such device)
3
Opened
Closing ([Errno 19] No such device)
3
Opened
Closing ([Errno 19] No such device)




[2s between replug]
3
Opened
skipped H (waiting for I)
Closing ([Errno 19] No such device)
3
Opened
skipped 6 (waiting for 7)
Closing ([Errno 19] No such device)
3
Opened
Closing ([Errno 19] No such device)
3
Opened
Closing ([Errno 19] No such device)
3
Opened
Closing ([Errno 19] No such device)


[1s between replug]
3
Opened
Closing ([Errno 19] No such device)
3
Opened
skipped S (waiting for T)
Closing ([Errno 19] No such device)
3
Opened
skipped Y (waiting for Z)
Closing ([Errno 19] No such device)
3


[VM died]

The error rate is visible from reconnections (keep in mind this was generated with 0.001s sleep between each send() cmds). Without this sleeps VM always crashed.
Comment 4 Lukas Doktor 2012-10-07 04:43:57 EDT
Sorry, I forgot to add qemu-cmdline, it was generated by autotest:

/usr/bin/qemu-kvm -S -name 'vm1' -nodefaults -chardev socket,id=hmp_id_hmp1,path=/tmp/monitor-hmp1-20121004-115412-sLj47KEF,server,nowait -mon chardev=hmp_id_hmp1,mode=readline -chardev socket,id=serial_id_serial1,path=/tmp/serial-serial1-20121004-115412-sLj47KEF,server,nowait -device isa-serial,chardev=serial_id_serial1 -device virtio-serial-pci,id=virtio_serial_pci0 -chardev socket,id=devvs1,path=/tmp/virtio_port-vs1-20121004-115412-sLj47KEF,server,nowait -device virtserialport,chardev=devvs1,name=com.redhat.spice.0,id=vs1,bus=virtio_serial_pci0.0 -chardev socket,id=devvs2,path=/tmp/virtio_port-vs2-20121004-115412-sLj47KEF,server,nowait -device virtserialport,chardev=devvs2,name=com.redhat.spice.1,id=vs2,bus=virtio_serial_pci0.0 -chardev socket,id=devvs3,path=/tmp/virtio_port-vs3-20121004-115412-sLj47KEF,server,nowait -device virtserialport,chardev=devvs3,name=com.redhat.spice.2,id=vs3,bus=virtio_serial_pci0.0 -chardev socket,id=devvs4,path=/tmp/virtio_port-vs4-20121004-115412-sLj47KEF,server,nowait -device virtserialport,chardev=devvs4,name=com.redhat.spice.3,id=vs4,bus=virtio_serial_pci0.0 -chardev socket,id=seabioslog_id_20121004-115412-sLj47KEF,path=/tmp/seabios-20121004-115412-sLj47KEF,server,nowait -device isa-debugcon,chardev=seabioslog_id_20121004-115412-sLj47KEF,iobase=0x402 -device ich9-usb-uhci1,id=usb1 -drive file='/tmp/kvm_autotest_root/images/f17-64.qcow2',index=0,if=ide,cache=none,snapshot=on -device virtio-net-pci,netdev=idbjSa34,mac='9a:13:14:15:16:17',id='idCjnNs4' -netdev tap,id=idbjSa34,fd=21 -m 512 -smp 1,cores=1,threads=1,sockets=1 -cpu 'Penryn' -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 -vnc :0 -vga std -rtc base=utc,clock=host,driftfix=none -boot order=cdn,once=c,menu=off -enable-kvm
Comment 5 Cole Robinson 2013-07-02 11:10:14 EDT

*** This bug has been marked as a duplicate of bug 863753 ***