Bug 556815 - Segfault at the first connection with Virt-manager
Summary: Segfault at the first connection with Virt-manager
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Daniel Veillard
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-01-19 14:34 UTC by Laurent Léonard
Modified: 2010-05-25 15:14 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2010-05-25 15:14:28 UTC
Embargoed:


Attachments (Terms of Use)
backtrace of libvirtd crash on SIGSEGV (31.98 KB, text/plain)
2010-01-20 20:33 UTC, Jamin W. Collins
no flags Details
SIGABRT on host USB device connect (29.93 KB, text/plain)
2010-01-21 13:46 UTC, Jamin W. Collins
no flags Details
debug output (1.97 MB, text/x-log)
2010-01-26 15:11 UTC, Jamin W. Collins
no flags Details

Description Laurent Léonard 2010-01-19 14:34:20 UTC
Description of problem:
libvirt crashes at the first connection with Virt-manager.

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

How reproducible:
Always.

Steps to Reproduce:
1. Try to connect locally with Virt-manager (QEMU/KVM driver).
  
Actual results:
Libvirt crashes at the first connection. If I start libvirt again and try to reconnect with Virt-manager it works great.

Expected results:
Libvirt should run normally.

Additional info:
Kernel log: libvirtd[20333] general protection ip:7f7fee5727c1 sp:7f7fe9a83d58 error:0 in libc-2.10.2.so[7f7fee4f9000+14a000]

Comment 1 Laurent Léonard 2010-01-19 21:46:36 UTC
GDB output:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffefca9f910 (LWP 27863)]
0x00007fff0158d7c1 in strlen () from /lib/libc.so.6

Comment 2 Jamin W. Collins 2010-01-20 20:33:21 UTC
Created attachment 385782 [details]
backtrace of libvirtd crash on SIGSEGV

I'm seeing similar behavior, though I can't say with certainty that it's 100% reproducible with the first virt-manager connection.  However, I do find that libvirtd is crashing fairly often.  I've captured a back trace following the Ubuntu guide here: https://wiki.ubuntu.com/Backtrace.  I've used the script at the bottom of that page to produce the attached backtrace.

Comment 3 Laurent Léonard 2010-01-20 23:45:19 UTC
I can confirm it's the same bug, I generated a similar backtrace.

Comment 4 Jamin W. Collins 2010-01-21 13:46:26 UTC
Created attachment 385921 [details]
SIGABRT on host USB device connect

Also seeing a crash with a SIGABRT when connecting an external USB drive to the host system, backtrace attached.

Comment 5 Jamin W. Collins 2010-01-24 22:03:16 UTC
Further details, it would appear that the connection crash isn't with the first virt-manager connection after system boot, but rather with the first connection attempt from a given instance of virt-manager.  That is if I start virt-manager and attempt to connect, libvirtd crashes.  If I restart libvirtd without closing virt-manager and then attempt a connection it connects properly.  However, if I then close virt-manager, reopen it, and then attempt a connection libvirtd crashes.

As this crash is 100% reproducible, it would be nice to have the priority and severity of this bug report increased and some acknowledgement that it's been at least seen.

For now I have to keep libvirtd propped up with a shell script that continually relaunches it if it exits.

Comment 6 Jamin W. Collins 2010-01-26 14:17:51 UTC
Additional debugging of this problem appears to have been done in the Debian BTS: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=565983

Their current conclusion is that this is some sort of hashmap corruption:

"So, somehow the hashmap contains a node with corrupted ->name; I tried setting
a watchpoint on ->name, but the node is deallocated almost immediatly in
remoteDispatchNodeDeviceLookupByName."

Comment 7 Daniel Berrangé 2010-01-26 14:27:17 UTC
It sounds like you can easily reproduce the crash, so could you try and collect a trace using valgrind. As you say it looks like memory corruption / mistaken free, and so valgrind is usually quite alot more helpful at diagnosing the problem than gdb traces.

Just stop the libvirtd daemon, and then run it manually with

 # valgrind --leak-check=full /usr/sbin/libvirt


it'll take quite a long time to startup, but once it does then try your virt-manager test case again.

Comment 8 Jamin W. Collins 2010-01-26 14:55:37 UTC
While I can reproduce the problem 100% of the time when running either normally or under gdb, I do not seem to be able to reproduce the problem under valgrind.  Startup doesn't appear to take that long really, only a few seconds.  After which it seems quite responsive to connection requests and does not segfault on the first connection from virt-manager.

Ideas?

Comment 9 Daniel Berrangé 2010-01-26 15:02:28 UTC
Hmm, that's rather unfortunate :-(

Can you edit /etc/libvirt/libvirtd.conf and set

 log_level=1
 log_outputs="1:/var/log/libvirt.log"

and then restart libvirtd & try and make it crash. it is possible the log file may end up with some helpful info leading upto the crash

Comment 10 Jamin W. Collins 2010-01-26 15:11:42 UTC
Created attachment 386846 [details]
debug output

The logging change you requested keep going to STDERR not the log file.  So, I redirected that to a file and have it attached.

Comment 11 Cole Robinson 2010-01-26 15:25:23 UTC
Might be worth seeing if this commit fixes the crash:

http://libvirt.org/git/?p=libvirt.git;a=commit;h=338e7c3c8d5b861f3ad376863519f3496736987e

Comment 12 Jamin W. Collins 2010-01-26 15:44:20 UTC
I've applied the referenced patch to my build and so far things look very good.  Thank you very, very much.

Comment 13 Laurent Léonard 2010-03-02 15:31:38 UTC
I confirm the problem is solved by the patch, thank you.


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