[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



On Wed, Nov 14, 2012 at 12:46:15PM +0200, Henrik Ahlgren wrote:
> 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?
> 
> #!/usr/bin/perl
> use Sys::Virt 0.9.2;
> my $vmm =  Sys::Virt->new(address => "qemu+ssh://root\ SOME HOST/system") or die;
> $SIG{'PIPE'} = 'IGNORE';
> $| = 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:

If you strace this, do you see the SIGPIPE handler being set to IGNORE. On
my system I do:


$ strace  ./demo.pl 2>&1 | grep SIGPIPE
rt_sigaction(SIGPIPE, {SIG_IGN, [], SA_RESTORER, 0x343ca0efe0}, NULL, 8) = 0
rt_sigaction(SIGPIPE, {SIG_IGN, [], SA_RESTORER, 0x343ca0efe0}, {SIG_IGN, [], SA_RESTORER, 0x343ca0efe0}, 8) = 0

and I don't see any EPIPE error when killing ssh

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 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]