[libvirt] [PATCH] Make error reporting in libvirtd thread safe

Daniel P. Berrange berrange at redhat.com
Wed Apr 13 18:31:54 UTC 2011


On Wed, Mar 23, 2011 at 04:52:47PM +0100, Jiri Denemark wrote:
> Bug https://bugzilla.redhat.com/show_bug.cgi?id=689374 reported libvirtd
> crash during error dispatch.
> 
> The reason is that libvirtd uses remoteDispatchConnError() with non-NULL
> conn parameter which means that virConnGetLastError() is used instead of
> its thread safe replacement virGetLastError().
> 
> So when several libvirtd threads are reporting errors at the same time,
> the errors can get mixed or corrupted or in case of bad luck libvirtd
> itself crashes.
> 
> Since Daniel B. is going to rewrite this code from scratch on top of his
> RPC infrastructure, I tried to come up with a minimal fix. Thus,
> remoteDispatchConnError() now just ignores its conn argument and always
> calls virGetLastError(). However, several callers had to be touched as
> well, since no libvirt API is allowed to be called before dispatching
> the error. Doing so would reset the error and we would have nothing to
> dispatch. As a result of that, the code is not very nice but that
> doesn't really make daemon/remote.c worse than it is now :-) And it will
> all die soon, which is good.

I split out my remote.c cleanup from the RPC rewrite and posted
the bits. This is the big refactoring of error handling to put
everything in one place, fixing many bugs...

  http://www.redhat.com/archives/libvir-list/2011-April/msg00668.html

The other patches before/after that just make the file prettier

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list