[libvirt-users] Handling connection closes in (older) Sys::Virt
Daniel P. Berrange
berrange at redhat.com
Wed Nov 14 10:08:45 UTC 2012
On Wed, Nov 14, 2012 at 10:15:25AM +0200, Henrik Ahlgren wrote:
> I hope this is the correct mailing list for discussing the Sys::Virt
> Perl module.
>
> It appears that the most recent version has a new method called
> register_close_callback that, I believe, can be used to catch errors
> when the connection to libvirt is closed, e.g. due to libvirt restart
> or a network related issue. (I've been testing this simply by killing
> the the SSH process in the libvirt server.)
>
> However, Debian still ships libvirt 0.9.12 in stable backports and
> testing, as probably do many other mainstream distributions. The
> latest Perl bindings that can be installed from CPAN is thus 0.9.12
> and it does not have support for close callbacks. Not only that, when
> a Perl program loses the (ssh) connection to libvirt, Perl just
> crashes:
>
> Program received signal SIGPIPE, Broken pipe.
> 0x00007ffff73de0d0 in __write_nocancel () from /lib/libpthread.so.0
>
> Setting a $SIG{PIPE} handler does not seem to help. Is there any
> possibility of a Perl program surviving and gracefully handling a
> closed libvirt connection with libvirt version 0.9.12 or
> older?
You definitely need to figure out how to set the SIGPIPE handler to
'ignore'. libvirt.so does not do this, because it is bad practice for
a library to set application global state like this. Not sure what
you tried, but I'd definitely expect this to work:
$SIG{'PIPE'} = 'IGNORE';
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 libvirt-users
mailing list