Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Net::SSH::Perl hangs(during cmd), but only in Mason environment

by perldragon80 (Sexton)
on Mar 12, 2005 at 01:26 UTC ( [id://438859]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Net::SSH::Perl hangs(during cmd), but only in Mason environment
in thread Net::SSH::Perl hangs(during cmd), but only in Mason environment

Well, after lots and lots of debugging I narrowed the problem down to the IO::Select module (being called by the Net::SSH::Perl::SSH2 module), which seems to be in a bad state on my system(See the attempted re-install below).
(Code in the SSH2.pm module makes the call)
my($rready, $wready) = $select_class->select($rb, $wb);
(Here is the select portion of Select.pm)
sub select { shift if defined $_[0] && !ref($_[0]); my($r,$w,$e,$t) = @_; my @result = (); my $rb = defined $r ? $r->[VEC_BITS] : undef; my $wb = defined $w ? $w->[VEC_BITS] : undef; my $eb = defined $e ? $e->[VEC_BITS] : undef; if(select($rb,$wb,$eb,$t) > 0) { my @r = (); my @w = (); my @e = (); my $i = _max(defined $r ? scalar(@$r)-1 : 0, defined $w ? scalar(@$w)-1 : 0, defined $e ? scalar(@$e)-1 : 0); for( ; $i >= FIRST_FD ; $i--) { my $j = $i - FIRST_FD; push(@r, $r->[$i]) if defined $rb && defined $r->[$i] && vec($rb, $j, 1); push(@w, $w->[$i]) if defined $wb && defined $w->[$i] && vec($wb, $j, 1); push(@e, $e->[$i]) if defined $eb && defined $e->[$i] && vec($eb, $j, 1); } @result = (\@r, \@w, \@e); } @result; }

Now I just need to figure out, why this would only break in a Mason environment....I think it is actually related to my system environment...because I tried to reinstall it from CPAN and got the following:
CPAN.pm: Going to build G/GB/GBARR/IO-1.20.tar.gz Checking for Socket...ok Checking if your kit is complete... Looks good Writing Makefile for IO cp IO/Dir.pm blib/lib/IO/Dir.pm cp IO/Handle.pm blib/lib/IO/Handle.pm cp IO/Socket/INET.pm blib/lib/IO/Socket/INET.pm cp IO/Poll.pm blib/lib/IO/Poll.pm cp IO/Pipe.pm blib/lib/IO/Pipe.pm cp IO/Seekable.pm blib/lib/IO/Seekable.pm cp IO/Socket.pm blib/lib/IO/Socket.pm cp IO/Select.pm blib/lib/IO/Select.pm cp IO/File.pm blib/lib/IO/File.pm cp IO.pm blib/lib/IO.pm cp IO/Socket/UNIX.pm blib/lib/IO/Socket/UNIX.pm /usr/local/bin/perl /usr/local/lib/perl5/5.8.6/ExtUtils/xsubpp -typem +ap /usr/local/lib/perl5/5.8.6/ExtUtils/typemap IO.xs > IO.xsc &&mv I +O.xsc IO.c cc -c -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -fno-strict-ali +asing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_B +ITS=64 -I/usr/include/gdbm -O2 -DVERSION=\"1.20\" -DXS_VERSION=\"1. +20\" -fpic "-I/usr/local/lib/perl5/5.8.6/i686-linux-thread-multi/CORE +" -DI_POLL IO.c In file included from /usr/local/lib/perl5/5.8.6/i686-linux-thread-mul +ti/CORE/perl.h:37, from IO.xs:9: /usr/local/lib/perl5/5.8.6/i686-linux-thread-multi/CORE/config.h:3017: +1: warning: "I_POLL" redefined <command line>:8:1: warning: this is the location of the previous defi +nition IO.xs: In function `XS_IO__Seekable_getpos': IO.xs:201: warning: passing arg 2 of `PerlIO_getpos' from incompatible + pointer type IO.xs:208: error: `sv_undef' undeclared (first use in this function) IO.xs:208: error: (Each undeclared identifier is reported only once IO.xs:208: error: for each function it appears in.) IO.xs: In function `XS_IO__Seekable_setpos': IO.xs:219: warning: passing arg 2 of `PerlIO_setpos' from incompatible + pointer type IO.xs: In function `XS_IO__File_new_tmpfile': IO.xs:252: error: `sv_undef' undeclared (first use in this function) make: *** [IO.o] Error 1 /usr/bin/make -- NOT OK Running make test Can't test without successful make Running make install make had returned bad status, install seems impossible

Replies are listed 'Best First'.
Re^4: Net::SSH::Perl hangs(during cmd), but only in Mason environment
by Phi01 (Initiate) on Mar 10, 2009 at 15:14 UTC
    What did you change to get it working?
Re^4: Net::SSH::Perl hangs(during cmd), but only in Mason environment
by cmv (Chaplain) on Aug 12, 2014 at 13:33 UTC
    I have this same issue, and took a closer look at the select() code.

    Note that $t is a timeout value that can be provided on the select call.

    By adding a timeout value to the select() call in SSH2.pm, you can avoid this.

    In SSH2.pm change this line:

    my($rready, $wready) = $select_class->select($rb, $wb);

    To have a timeout value (1 second), like this:

    my($rready, $wready) = $select_class->select($rb, $wb, undef, 1);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://438859]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-07-19 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.