[Libvir] crash on domain shutdown (via ruby)

David Lutterkort dlutter at redhat.com
Fri Apr 11 05:16:03 UTC 2008

Hi Vadim,

seems you're having the honor of testing the new improved error
reporting in ruby-libvirt.

The way virResetError was used was incorrect: it can only be called if
virConnCopyLastError returned a positive result. For some reason, in
your example virDomainShutdown fails, but the error status on the
connection seems to still be VIR_ERR_OK.

I just committed a change to ruby-libvirt to address that; can you give
that a try ?

The virResetError docs are not clear on when it can be called, and when
it must not be called. It seems like a useless optimization that the
memcpy of the error only happens when there was an error - the
virConnCopyLastError/virCopyLastError routines also need to strdup the
various strings in a virError, otherwise it is possible that the same
string gets freed multiple times when there are multiple matching
copy/reset calls.


More information about the libvir-list mailing list