Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1170042

Summary: "Guest moved used index from 337 to 336" repeatedly hotplug/hotunplug serial port that transferring data
Product: Red Hat Enterprise Linux 7 Reporter: langfang <flang>
Component: qemu-kvmAssignee: pagupta
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: amit.shah, hannsj_uhl, hhuang, juzhang, mdeng, michen, qzhang, rbalakri, virt-bugs, virt-maint, xfu, yduan
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1170391 (view as bug list) Environment:
Last Closed: 2017-03-29 06:26:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1170391    
Attachments:
Description Flags
full log none

Description langfang 2014-12-03 05:50:22 UTC
Description of problem:
qemu core dump while repeadly hotplug/hotunplug serial port that transftering data

Version-Release number of selected component (if applicable):
Host:
# uname -r
3.10.0-212.el7.x86_64
# rpm -q qemu-kvm
qemu-kvm-1.5.3-83.el7.x86_64

Guest:
3.10.0-206.el7.x86_64


How reproducible:
1/1

Steps to Reproduce:
1.Boot guest with 
...-device virtio-serial-pci,id=virtio-serial0,max_ports=31,bus=pci.0,addr=0x7,ioeventfd=on -chardev socket,id=channel0,path=/tmp/port0,server,nowait -device virtserialport,chardev=channel0,name=org.linux-kvm.port.0,bus=virtio-serial0.0,id=port0 -chardev socket,id=channel1,path=/tmp/port1,server,nowait -device virtserialport,chardev=channel1,name=org.linux-kvm.port.1,bus=virtio-serial0.0,id=port1...

2.Transfer data from guest to host
***Using port0:

Guest:
#hdxdump /dev/sda2 >lang.txt
#cat lang1.txt >/dev/vport1p1


Host:
# nc -U /tmp/port0

***Using port1:
#hdxdump /dev/sda2 >lang.txt
#cat lang1.txt >/dev/vport1p2

Host:
# nc -U /tmp/port1

3.Hotunplug the port 

 telnet 10.66.4.103 4445
Trying 10.66.4.103...
Connected to 10.66.4.103.
Escape character is '^]'.
{"QMP": {"version": {"qemu": {"micro": 3, "minor": 5, "major": 1}, "package": " (qemu-kvm-1.5.3-83.el7)"}, "capabilities": []}}
{"execute":"qmp_capabilities"}
{"return": {}}
{"execute":"device_del","arguments":{"id":"port0"}}{"timestamp": {"seconds": 1417584510, "microseconds": 177202}, "event": "VSERPORT_CHANGE", "data": {"open": true, "id": "port0"}}
{"execute":"device_del","arguments":{"id":"port0"}}
{"timestamp": {"seconds": 1417584539, "microseconds": 769531}, "event": "DEVICE_DELETED", "data": {"device": "port0", "path": "/machine/peripheral/port0"}}
{"return": {}}
{"error": {"class": "DeviceNotFound", "desc": "Device 'port0' not found"}}
{"execute":"device_add","arguments":{"driver":"virtserialport","bus":"virtio-serial0.0","chardev":"channel0","name":"org.linux-kvm.port.0","id":"port0"}}
{"return": {}}
{"timestamp": {"seconds": 1417584587, "microseconds": 139108}, "event": "VSERPORT_CHANGE", "data": {"open": true, "id": "port0"}}
{"execute":"device_del","arguments":{"id":"port0"}}
{"timestamp": {"seconds": 1417584602, "microseconds": 120245}, "event": "DEVICE_DELETED", "data": {"device": "port0", "path": "/machine/peripheral/port0"}}
{"return": {}}
{"timestamp": {"seconds": 1417584672, "microseconds": 125392}, "event": "VSERPORT_CHANGE", "data": {"open": true, "id": "port1"}}
{"timestamp": {"seconds": 1417584678, "microseconds": 729218}, "event": "VSERPORT_CHANGE", "data": {"open": false, "id": "port1"}}


Actual results: QEMU crash
Program received signal SIGPIPE, Broken pipe.
0x00007ffff580f1fd in write () from /lib64/libpthread.so.0
(gdb) bt
#0  0x00007ffff580f1fd in write () from /lib64/libpthread.so.0
#1  0x00007ffff6aa72cc in g_io_unix_write () from /lib64/libglib-2.0.so.0
#2  0x00007ffff6a5944d in g_io_channel_write_chars ()
   from /lib64/libglib-2.0.so.0
#3  0x00005555556cfafe in io_channel_send (fd=0x55555659bdc0, 
    buf=0x7fffccdabec0, len=16704) at qemu-char.c:787
#4  0x00005555556324ee in flush_buf (port=0x5555565c34d0, buf=<optimized out>, 
    len=16704) at hw/char/virtio-console.c:52
#5  0x000055555572e54d in do_flush_queued_data (port=0x5555565c34d0, 
    vq=0x555556598618, vdev=0x55555658e508)
    at /usr/src/debug/qemu-1.5.3/hw/char/virtio-serial-bus.c:131
#6  0x00005555555cbab7 in aio_bh_poll (ctx=ctx@entry=0x5555564c2600)
    at async.c:81
#7  0x00005555555cb708 in aio_poll (ctx=0x5555564c2600, 
    blocking=blocking@entry=false) at aio-posix.c:185
#8  0x00005555555cb9c0 in aio_ctx_dispatch (source=<optimized out>, 
    callback=<optimized out>, user_data=<optimized out>) at async.c:200
#9  0x00007ffff6a639ba in g_main_context_dispatch ()
   from /lib64/libglib-2.0.so.0
#10 0x00005555556a3a6a in glib_pollfds_poll () at main-loop.c:187
#11 os_host_main_loop_wait (timeout=<optimized out>) at main-loop.c:232
#12 main_loop_wait (nonblocking=<optimized out>) at main-loop.c:464
#13 0x00005555555c74e0 in main_loop () at vl.c:1987
---Type <return> to continue, or q <return> to quit---t
#14 main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>)
    at vl.c:4378


Expected results:


Additional info:
bt full see attachment.

My CLI:
 /usr/libexec/qemu-kvm -enable-kvm -m 4G -smp 4 -uuid `uuidgen` -nodefaults -rtc base=utc -drive file=/home/rhel7.1-64.raw,if=none,id=drive-system-disk,format=raw,cache=none,serial=QEMU-DISK1 -device ide-drive,drive=drive-system-disk,id=sytem-disk  -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device e1000,netdev=hostnet0,id=net0,mac=52:54:00:60:3f:29,addr=0x4 -monitor stdio -boot menu=on,order=d -qmp tcp:0:4445,server,nowait -vnc :10 -vga std -device virtio-balloon-pci,bus=pci.0,id=balloon0  -device virtio-serial-pci,id=virtio-serial0,max_ports=31,bus=pci.0,addr=0x7,ioeventfd=on -chardev socket,id=channel0,path=/tmp/port0,server,nowait -device virtserialport,chardev=channel0,name=org.linux-kvm.port.0,bus=virtio-serial0.0,id=port0 -chardev socket,id=channel1,path=/tmp/port1,server,nowait -device virtserialport,chardev=channel1,name=org.linux-kvm.port.1,bus=virtio-serial0.0,id=port1

Comment 1 langfang 2014-12-03 05:51:48 UTC
Created attachment 963982 [details]
full log

Comment 3 Amit Shah 2014-12-03 06:10:03 UTC
Pls try without gdb.

When using gdb, issue this command before running the guest:

'handle SIGPIPE nostop noprint'

that will ensure you won't see this sigpipe problem

Comment 4 langfang 2014-12-03 06:53:16 UTC
(In reply to Amit Shah from comment #3)
> Pls try without gdb.
> 
> When using gdb, issue this command before running the guest:
> 
> 'handle SIGPIPE nostop noprint'
> 
> that will ensure you won't see this sigpipe problem

Hi Amit
   
   Test again, hit such error:

[New Thread 0x7fffda1ff700 (LWP 8852)]
[New Thread 0x7fffd97ff700 (LWP 8853)]
[Thread 0x7fffda1ff700 (LWP 8852) exited]
[New Thread 0x7fffda1ff700 (LWP 8866)]
[Thread 0x7fffda1ff700 (LWP 8866) exited]
[New Thread 0x7fffda1ff700 (LWP 8876)]

(qemu) [Thread 0x7fffda1ff700 (LWP 8876) exited]

(qemu) [New Thread 0x7fffda1ff700 (LWP 8878)]
qemu-kvm: Guest moved used index from 337 to 336
Detaching after fork from child process 8888.
/etc/qemu-ifdown: could not launch network script
[Thread 0x7fffd97ff700 (LWP 8853) exited]
[Thread 0x7fffda1ff700 (LWP 8878) exited]
[Thread 0x7fffdbfff700 (LWP 8802) exited]
[Thread 0x7fffe89ee700 (LWP 8799) exited]
[Thread 0x7fffe99f0700 (LWP 8797) exited]
[Thread 0x7ffff7fb7a40 (LWP 8784) exited]
[Inferior 1 (process 8784) exited with code 01]
(gdb) 


Steps:
1.(gdb) handle SIGPIPE nostop noprint
Signal        Stop	Print	Pass to program	Description
SIGPIPE       No	No	Yes		Broken pipe

2.Boot guest with 

-device virtio-serial-pci,id=virtio-serial0,max_ports=31,bus=pci.0,addr=0x7,ioeventfd=on -chardev socket,id=channel0,path=/tmp/port0,server,nowait -device virtserialport,chardev=channel0,name=org.linux-kvm.port.0,bus=virtio-serial0.0,id=port0 -chardev socket,id=channel1,path=/tmp/port1,server,nowait -device virtserialport,chardev=channel1,name=org.linux-kvm.port.1,bus=virtio-serial0.0,id=port1...

3.Transfer data from guest to host
***Using port0:

Guest:
#hdxdump /dev/sda2 >lang.txt
#cat lang1.txt >/dev/vport1p1


Host:
# nc -U /tmp/port0

4.Hotunplug the port 
{"execute":"device_del","arguments":{"id":"port0"}}

5.Hotplug port
{"execute":"device_add","arguments":{"driver":"virtserialport","bus":"virtio-serial0.0","chardev":"channel0","name":"org.linux-kvm.port.0","id":"port0"}}
{"return": {}}


Results:
(qemu) [New Thread 0x7fffda1ff700 (LWP 8878)]
qemu-kvm: Guest moved used index from 337 to 336
Detaching after fork from child process 8888.
/etc/qemu-ifdown: could not launch network script
[Thread 0x7fffd97ff700 (LWP 8853) exited]
[Thread 0x7fffda1ff700 (LWP 8878) exited]
[Thread 0x7fffdbfff700 (LWP 8802) exited]
[Thread 0x7fffe89ee700 (LWP 8799) exited]
[Thread 0x7fffe99f0700 (LWP 8797) exited]
[Thread 0x7ffff7fb7a40 (LWP 8784) exited]
[Inferior 1 (process 8784) exited with code 01]
(gdb)

Comment 5 Amit Shah 2014-12-03 07:07:25 UTC
(In reply to langfang from comment #4)
>    Test again, hit such error:

> qemu-kvm: Guest moved used index from 337 to 336

This is a different error, but let's use this for this bug.

This means the guest's and host's idea of the vq changed.  Will have to investigate why.

Did you have the script inside the guest (cat lang1.txt > /dev/vport1p1) running continuously?

Comment 6 langfang 2014-12-03 07:46:40 UTC
(In reply to Amit Shah from comment #5)
> (In reply to langfang from comment #4)
> >    Test again, hit such error:
> 
> > qemu-kvm: Guest moved used index from 337 to 336
> 
> This is a different error, but let's use this for this bug.
> 
> This means the guest's and host's idea of the vq changed.  Will have to
> investigate why.
> 
> Did you have the script inside the guest (cat lang1.txt > /dev/vport1p1)
> running continuously?

I hotunplug the port while transfering data (*guest run:cat lang1.txt > /dev/vport1p1  *host: nc -U /tmp/port0 )from guest to host.

{"execute":"device_del","arguments":{"id":"port0"}}


# ll -lh lang1.txt 
-rw-r--r--. 1 root root 711M Dec  3 12:07 lang1.txt

Comment 13 pagupta 2017-03-29 06:26:11 UTC
Hello,

As per update in comment 12, closing this BZ. 
Please reopen it if issue appears.

Thanks,
Pankaj