Bug 523953 - Detaching device through virsh detach-device command fails - libvirtd segfault
Detaching device through virsh detach-device command fails - libvirtd segfault
Product: Fedora
Classification: Fedora
Component: libvirt (Show other bugs)
All Linux
high Severity high
: ---
: ---
Assigned To: Mark McLoughlin
Fedora Extras Quality Assurance
Depends On:
Blocks: F12VirtBlocker
  Show dependency treegraph
Reported: 2009-09-17 07:33 EDT by Martin Banas
Modified: 2009-09-17 10:59 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-09-17 10:59:43 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
VM_connection_failure traceback (15.80 KB, image/png)
2009-09-17 07:33 EDT, Martin Banas
no flags Details
VM_cannot_start traceback (15.83 KB, image/png)
2009-09-17 07:34 EDT, Martin Banas
no flags Details
gdb libvirtd (9.56 KB, text/plain)
2009-09-17 08:27 EDT, Martin Banas
no flags Details
(gdb) backtrace of libvirtd (1.72 KB, text/plain)
2009-09-17 08:35 EDT, Martin Banas
no flags Details

  None (edit)
Description Martin Banas 2009-09-17 07:33:23 EDT
Created attachment 361483 [details]
VM_connection_failure traceback

Description of problem:
Detaching device through virsh detach-device command fails
error: Failed to detach device from XML-file
error: server closed connection

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. install Fedora 12 by any means
2. install group Virtualization
3. run virt-manager and create new virtual machine
4. install F11-Gold into the virtual machine
5. reboot to the installed system and then shut down.

6. execute virsh edit <your_guest_name> , remove every <interface> blocks in the file, save the file
7. create new xml file:
<interface type='network'>
  <mac address='52:54:00:ab:cd:ef' />
  <source network='default' />
  <model type='virtio' />
8. run the virtual machine through virt-manager. Open the window with your guest.

9. make sure that there is no interface in ifconfig than lo.
10. attach new interface by executing in console:
virsh attach-device <your_guest_name> <name_of_xml_file>
11. detach the interface by running:
virsh detach-device <your_guest_name> <name_of_xml_file>

Actual results:
in console:
error: Failed to detach device from XML-file
error: server closed connection

the viewer of the guest has closed, window "Virtual Machine Manager" is not responding.

running virt-manager again shows message:
see 'VM_connection_failure.png'

[root@hp-xw9400-01 ~]# /etc/init.d/libvirtd status
libvirtd dead but pid file exists

restarting libvirtd service and running virt-manager, virt-manager shows the guest is running. Stopping the guest and then running again shows error message: see 'VM_cannot_start.png'

Expected results:
No errors, root can detach device.

Additional info:
after rebooting the machine user is again able to start the virtual guest
Comment 1 Martin Banas 2009-09-17 07:34:35 EDT
Created attachment 361484 [details]
VM_cannot_start traceback
Comment 2 Martin Banas 2009-09-17 07:35:23 EDT
Kernel version: 2.6.31-14.fc12.x86_64
Comment 3 Mark McLoughlin 2009-09-17 07:56:57 EDT
Does /var/log/messages show that libvirtd segfaulted ?

if so, try this:

  $> service libvirtd stop
  $> yum install -y libvirt-debuginfo
  $> gdb libvirtd
  (gdb) run

and then repeat the procedure and capture a stack trace
Comment 4 Martin Banas 2009-09-17 08:27:16 EDT
Created attachment 361487 [details]
gdb libvirtd
Comment 5 Daniel Berrange 2009-09-17 08:30:58 EDT
You need to type 'backtrace' in the (gdb) prompt when it crashes to get a proper trace. The one you attached is just glibc output which isn't as detailed as what gdb will give us.
Comment 6 Martin Banas 2009-09-17 08:35:54 EDT
Created attachment 361491 [details]
(gdb) backtrace of libvirtd
Comment 7 Mark McLoughlin 2009-09-17 09:12:12 EDT
Looks like it's this:


+    } else {
+        VIR_FREE(vm->def->nets[0]);
+        vm->def->nnets = 0;
+    virDomainNetDefFree(detach);

That should be:

+        VIR_FREE(vm->def->nets);

Fix coming soon
Comment 8 Mark McLoughlin 2009-09-17 10:59:43 EDT
Fixes are building in rawhide now:

* Thu Sep 17 2009 Mark McLoughlin <markmc@redhat.com> - 0.7.1-4
- A couple of hot-unplug memory handling fixes (#523953)

I'll push them upstream too once they're reviewed

Thanks Marthin!

Note You need to log in before you can comment on or make changes to this bug.