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 1349390

Summary: VM crashes after redirected USB rude detachment from client
Product: Red Hat Enterprise Linux 7 Reporter: Radek Duda <rduda>
Component: spiceAssignee: Default Assignee for SPICE Bugs <rh-spice-bugs>
Status: CLOSED DUPLICATE QA Contact: SPICE QE bug list <spice-qe-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.3CC: cfergeau, marcandre.lureau, pgrunt, rduda, spice-qe-bugs, tpelka
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-24 08:16:52 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:
Attachments:
Description Flags
spice-debug log
none
qemu-kvm backtrace none

Description Radek Duda 2016-06-23 11:53:56 UTC
Created attachment 1171436 [details]
spice-debug log

Description of problem:
If I physically detach USB drive (redirected to guest) from client ,the guest VM crashes.

Version-Release number of selected component (if applicable):
tested for guests rhel 7.3, rhel 6.8
client rhel 7.3 nightly
virt-viewer-2.0-8.el7.x86_64
spice-server-0.12.4-17.el7.x86_64

How reproducible:always


Steps to Reproduce:
1.Boot guest VM
2.Redirect USB device connected to client
3.detach USB device from client machine without any redirection

Actual results:
guest VM crashes with error:
(remote-viewer:12225): GSpice-CRITICAL **: usbredirhost: error resetting device: LIBUSB_ERROR_NO_DEVICE



Expected results:no crash


Additional info:spice-debug log attached

Comment 1 Pavel Grunt 2016-06-23 12:16:22 UTC
Hey, if server crashed, what are the server logs ? See also the bug 1338752 which is related to server/guest issues after disconnection of usb device

Comment 2 Marc-Andre Lureau 2016-06-23 12:29:30 UTC
(In reply to Radek Duda from comment #0)
> Steps to Reproduce:
> 1.Boot guest VM
> 2.Redirect USB device connected to client
> 3.detach USB device from client machine without any redirection
> 
> Actual results:
> guest VM crashes with error:
> (remote-viewer:12225): GSpice-CRITICAL **: usbredirhost: error resetting
> device: LIBUSB_ERROR_NO_DEVICE
>

This is an error/warning from the client.

Could you try to provide with a backtrace of the client if it crashes, or of qemu if it's really the guest that crahses. thanks?

Comment 3 Radek Duda 2016-06-23 13:08:08 UTC
Created attachment 1171492 [details]
qemu-kvm backtrace

Comment 4 Radek Duda 2016-06-23 13:10:58 UTC
Pavel, I found the bug 1338752 to be very similar. The USB device does not have to be detached rudely,but even when detaching with remote-viewer redirection the guest crashes.
To server log right after USB detachment are added these lines:
qemu-kvm: spice-qemu-char.c:188: spice_chr_write: Assertion `s->datalen == 0' failed.
2016-06-23 12:58:38.689+0000: shutting down

versions of used components:
# rpm -q usbredir qemu-kvm kernel libvirt
usbredir-0.7.1-1.el7.x86_64
qemu-kvm-1.5.3-115.el7.x86_64
kernel-3.10.0-445.el7.x86_64
libvirt-1.3.5-1.el7.x86_64
$ rpm -qa | grep spice
spice-glib-0.31-3.el7.x86_64
spice-gtk3-0.31-3.el7.x86_64
spice-protocol-0.12.11-1.el7.noarch
spice-gtk-0.31-3.el7.x86_64
spice-server-0.12.4-17.el7.x86_64
spice-gtk-tools-0.31-3.el7.x86_64
spice-vdagent-0.14.0-13.el7.x86_64

the crash is in qemu-kvm. The backtrace is attached.

Comment 5 Pavel Grunt 2016-06-24 08:16:52 UTC
The reproducer, result and the backtrace are similar as in the bug 1338752, closing as duplicate

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