[libvirt-users] Handling connection closes in (older) Sys::Virt

Henrik Ahlgren pablo at seestieto.com
Wed Nov 14 10:46:15 UTC 2012

On Wed, Nov 14, 2012 at 10:08:45AM +0000, Daniel P. Berrange wrote:

> 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';

I don't know what I'm doing wrong, but consider the following simple
test script. Perhaps this is a Debian issue?

use Sys::Virt 0.9.2;
my $vmm =  Sys::Virt->new(address => "qemu+ssh://root\@SOME.HOST/system") or die;
$| = 1;
while (1) {
    eval { my $dummy = $vmm->get_node_info };
    print ".";
    sleep 1;

Let's run it and go to SOME.HOST to kill the SSH process:

$ gdb perl
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from /usr/bin/perl...(no debugging symbols found)...done.
(gdb) run lv.pl
Starting program: /usr/bin/perl lv.pl
[Thread debugging using libthread_db enabled]
Program received signal SIGPIPE, Broken pipe.
0x00007ffff73de0d0 in __write_nocancel () from /lib/libpthread.so.0
(gdb) bt
#0  0x00007ffff73de0d0 in __write_nocancel () from /lib/libpthread.so.0
#1  0x00007ffff6876226 in ?? () from /usr/lib/libvirt.so.0
#2  0x00007ffff687643e in ?? () from /usr/lib/libvirt.so.0
#3  0x00007ffff6867d31 in ?? () from /usr/lib/libvirt.so.0
#4  0x00007ffff68685e1 in ?? () from /usr/lib/libvirt.so.0
#5  0x00007ffff6868c47 in ?? () from /usr/lib/libvirt.so.0
#6  0x00007ffff6869421 in ?? () from /usr/lib/libvirt.so.0
#7  0x00007ffff68436cc in ?? () from /usr/lib/libvirt.so.0
#8  0x00007ffff684376c in ?? () from /usr/lib/libvirt.so.0
#9  0x00007ffff684e5e5 in ?? () from /usr/lib/libvirt.so.0
#10 0x00007ffff68191e0 in virNodeGetInfo () from /usr/lib/libvirt.so.0
#11 0x00007ffff6c16b48 in XS_Sys__Virt_get_node_info (my_perl=<value optimized out>, cv=<value optimized out>) at Virt.xs:1450
#12 0x00007ffff7b1d675 in Perl_pp_entersub () from
#13 0x00007ffff7b1bbb6 in Perl_runops_standard () from
#14 0x00007ffff7ac078c in perl_run () from /usr/lib/libperl.so.5.10
#15 0x0000000000400f24 in main ()

More information about the libvirt-users mailing list