Skip Menu |

This queue is for tickets about the Net-SSH2 CPAN distribution.

Report information
The Basics
Id: 91396
Status: rejected
Priority: 0/
Queue: Net-SSH2

People
Owner: Nobody in particular
Requestors: jjoshi [...] idirect.net
Cc: randomcoder1 [...] gmail.com
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Net::SSH2::connect
Date: Fri, 13 Dec 2013 14:55:36 +0000
To: "bug-Net-SSH2 [...] rt.cpan.org" <bug-Net-SSH2 [...] rt.cpan.org>
From: "Joshi, Jayesh" <jjoshi [...] idirect.net>
Hi, I would expect the connection to timeout should be 30 seconds in the following test script. However the timeout is reported after approx. 3.01 seconds. (BTW - I tried increasing the timeout to 3000, but I see similar results.) FYI : I have the following: [JKJ Dev] # perl -MNet::SSH2\ 9999 Net::SSH2 version 9999 required--this is only version 0.53. The test script: #!/usr/local/bin/perl use strict; use warnings; use Time::HiRes qw(gettimeofday tv_interval); use Data::Dumper; use Net::SSH2; my $host = "10.1.244.66"; # unreachable IP my $port = "9675"; my $timeout = 30; my $ssh2 = Net::SSH2->new(); print "Making Connection\n"; my $t0 = [gettimeofday()]; eval { $ssh2->connect($host, $port, Timeout=>$timeout); # $ssh2->connect($host, $port); }; my $lapsed_time = tv_interval ( $t0, [gettimeofday()]); if ($@) { print ("Lapsed Time = $lapsed_time, Connection failed to Host: $host on Port: $port , with Timeout: $timeout seconds.\n"); } else { print "Fat Lady is singing!\n"; } 1; Is there a bug with the "Timeout" in Net::SSH2::connect method? Regards, Jayesh Show quoted text
________________________________ Jayesh Joshi Senior Software Engineer, SatManage * p: +44 1234.759.615 * m: +447951 783 920 Please note our new business address: iDirect, 1st Floor Derwent House, University Way, Cranfield, Beds, MK43 0AZ, UK * www.idirect.net<http://www.idirect.net/> * Advancing a Connected World Connect with iDirect: Twitter.com/iDirect<http://twitter.com/idirect> * Facebook.com/iDirect<http://www.facebook.com/idirect>
Subject: Re: [rt.cpan.org #91396] Net::SSH2::connect
Date: Sat, 14 Dec 2013 03:56:54 -0800
To: bug-Net-SSH2 [...] rt.cpan.org
From: Rafael Kitover <rkitover [...] gmail.com>
Does it work with IO::Socket? The option is passed to IO::Socket. On Fri, Dec 13, 2013 at 6:56 AM, Joshi, Jayesh via RT < bug-Net-SSH2@rt.cpan.org> wrote: Show quoted text
> Fri Dec 13 09:56:10 2013: Request 91396 was acted upon. > Transaction: Ticket created by jjoshi@idirect.net > Queue: Net-SSH2 > Subject: Net::SSH2::connect > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: jjoshi@idirect.net > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=91396 > > > > Hi, > > I would expect the connection to timeout should be 30 seconds in the > following test script. > > However the timeout is reported after approx. 3.01 seconds. (BTW - I > tried increasing the timeout to 3000, but I see similar results.) > > FYI : I have the following: > > [JKJ Dev] # perl -MNet::SSH2\ 9999 > Net::SSH2 version 9999 required--this is only version 0.53. > > The test script: > > #!/usr/local/bin/perl > use strict; > use warnings; > use Time::HiRes qw(gettimeofday tv_interval); > use Data::Dumper; > > use Net::SSH2; > > my $host = "10.1.244.66"; # unreachable IP > my $port = "9675"; > my $timeout = 30; > > my $ssh2 = Net::SSH2->new(); > print "Making Connection\n"; > my $t0 = [gettimeofday()]; > eval { > $ssh2->connect($host, $port, Timeout=>$timeout); > # $ssh2->connect($host, $port); > }; > my $lapsed_time = tv_interval ( $t0, [gettimeofday()]); > > if ($@) { > print ("Lapsed Time = $lapsed_time, Connection failed to Host: $host > on Port: $port , with Timeout: $timeout seconds.\n"); > } else { > print "Fat Lady is singing!\n"; > } > > 1; > > Is there a bug with the "Timeout" in Net::SSH2::connect method? > > Regards, > > Jayesh > ________________________________ > Jayesh Joshi Senior Software Engineer, SatManage * p: +44 1234.759.615 * > m: +447951 783 920 > Please note our new business address: > iDirect, 1st Floor Derwent House, University Way, Cranfield, Beds, MK43 > 0AZ, UK * www.idirect.net<http://www.idirect.net/> * Advancing a > Connected World > Connect with iDirect: Twitter.com/iDirect<http://twitter.com/idirect> * > Facebook.com/iDirect<http://www.facebook.com/idirect> > > > >
Subject: Net::SSH2::connect worksforme
WORKSFORME with IO::Socket and Net::SSH2. $ TIME="%E" time perl -MIO::Socket::INET -e '$s=IO::Socket::INET->new(PeerHost => "173.194.39.165", PeerPort=>"3246", Timeout=>40); print "finished and timed out\n";' finished and timed out 0:40.07 $ TIME="%E" time perl -I./local/lib/perl5 -MNet::SSH2 -e 'eval{Net::SSH2->new()->connect("173.194.39.165","3246", Timeout=>40);}; print "finished and timed out\n" if $@;' finished and timed out 0:40.07 On Sat Dec 14 06:57:11 2013, rkitover@gmail.com wrote: Show quoted text
> Does it work with IO::Socket? The option is passed to IO::Socket. > > > On Fri, Dec 13, 2013 at 6:56 AM, Joshi, Jayesh via RT < > bug-Net-SSH2@rt.cpan.org> wrote: >
> > Fri Dec 13 09:56:10 2013: Request 91396 was acted upon. > > Transaction: Ticket created by jjoshi@idirect.net > > Queue: Net-SSH2 > > Subject: Net::SSH2::connect > > Broken in: (no value) > > Severity: (no value) > > Owner: Nobody > > Requestors: jjoshi@idirect.net > > Status: new > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=91396 > > > > > > > Hi, > > > > I would expect the connection to timeout should be 30 seconds in the > > following test script. > > > > However the timeout is reported after approx. 3.01 seconds. (BTW - I > > tried increasing the timeout to 3000, but I see similar results.) > > > > FYI : I have the following: > > > > [JKJ Dev] # perl -MNet::SSH2\ 9999 > > Net::SSH2 version 9999 required--this is only version 0.53. > > > > The test script: > > > > #!/usr/local/bin/perl > > use strict; > > use warnings; > > use Time::HiRes qw(gettimeofday tv_interval); > > use Data::Dumper; > > > > use Net::SSH2; > > > > my $host = "10.1.244.66"; # unreachable IP > > my $port = "9675"; > > my $timeout = 30; > > > > my $ssh2 = Net::SSH2->new(); > > print "Making Connection\n"; > > my $t0 = [gettimeofday()]; > > eval { > > $ssh2->connect($host, $port, Timeout=>$timeout); > > # $ssh2->connect($host, $port); > > }; > > my $lapsed_time = tv_interval ( $t0, [gettimeofday()]); > > > > if ($@) { > > print ("Lapsed Time = $lapsed_time, Connection failed to Host: $host > > on Port: $port , with Timeout: $timeout seconds.\n"); > > } else { > > print "Fat Lady is singing!\n"; > > } > > > > 1; > > > > Is there a bug with the "Timeout" in Net::SSH2::connect method? > > > > Regards, > > > > Jayesh > > ________________________________ > > Jayesh Joshi Senior Software Engineer, SatManage * p: +44 1234.759.615 * > > m: +447951 783 920 > > Please note our new business address: > > iDirect, 1st Floor Derwent House, University Way, Cranfield, Beds, MK43 > > 0AZ, UK * www.idirect.net<http://www.idirect.net/> * Advancing a > > Connected World > > Connect with iDirect: Twitter.com/iDirect<http://twitter.com/idirect> * > > Facebook.com/iDirect<http://www.facebook.com/idirect> > > > > > > > >
-- Your bugs , they are afraid of me.
On Fri Mar 07 22:37:33 2014, WSDOOKADR wrote: Show quoted text
> WORKSFORME with IO::Socket and Net::SSH2. > > $ TIME="%E" time perl -MIO::Socket::INET -e '$s=IO::Socket::INET-
> >new(PeerHost => "173.194.39.165", PeerPort=>"3246", Timeout=>40);
> print "finished and timed out\n";' > > finished and timed out > 0:40.07 > > $ TIME="%E" time perl -I./local/lib/perl5 -MNet::SSH2 -e > 'eval{Net::SSH2->new()->connect("173.194.39.165","3246", > Timeout=>40);}; print "finished and timed out\n" if $@;' > > finished and timed out > 0:40.07 > > > > On Sat Dec 14 06:57:11 2013, rkitover@gmail.com wrote:
> > Does it work with IO::Socket? The option is passed to IO::Socket. > > > > > > On Fri, Dec 13, 2013 at 6:56 AM, Joshi, Jayesh via RT < > > bug-Net-SSH2@rt.cpan.org> wrote: > >
> > > Fri Dec 13 09:56:10 2013: Request 91396 was acted upon. > > > Transaction: Ticket created by jjoshi@idirect.net > > > Queue: Net-SSH2 > > > Subject: Net::SSH2::connect > > > Broken in: (no value) > > > Severity: (no value) > > > Owner: Nobody > > > Requestors: jjoshi@idirect.net > > > Status: new > > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=91396 > > > > > > > > > > Hi, > > > > > > I would expect the connection to timeout should be 30 seconds in > > > the > > > following test script. > > > > > > However the timeout is reported after approx. 3.01 seconds. (BTW - > > > I > > > tried increasing the timeout to 3000, but I see similar results.) > > > > > > FYI : I have the following: > > > > > > [JKJ Dev] # perl -MNet::SSH2\ 9999 > > > Net::SSH2 version 9999 required--this is only version 0.53. > > > > > > The test script: > > > > > > #!/usr/local/bin/perl > > > use strict; > > > use warnings; > > > use Time::HiRes qw(gettimeofday tv_interval); > > > use Data::Dumper; > > > > > > use Net::SSH2; > > > > > > my $host = "10.1.244.66"; # unreachable IP > > > my $port = "9675"; > > > my $timeout = 30; > > > > > > my $ssh2 = Net::SSH2->new(); > > > print "Making Connection\n"; > > > my $t0 = [gettimeofday()]; > > > eval { > > > $ssh2->connect($host, $port, Timeout=>$timeout); > > > # $ssh2->connect($host, $port); > > > }; > > > my $lapsed_time = tv_interval ( $t0, [gettimeofday()]); > > > > > > if ($@) { > > > print ("Lapsed Time = $lapsed_time, Connection failed to > > > Host: $host > > > on Port: $port , with Timeout: $timeout seconds.\n"); > > > } else { > > > print "Fat Lady is singing!\n"; > > > } > > > > > > 1; > > > > > > Is there a bug with the "Timeout" in Net::SSH2::connect method? > > > > > > Regards, > > > > > > Jayesh > > > ________________________________ > > > Jayesh Joshi Senior Software Engineer, SatManage * p: +44 > > > 1234.759.615 * > > > m: +447951 783 920 > > > Please note our new business address: > > > iDirect, 1st Floor Derwent House, University Way, Cranfield, Beds, > > > MK43 > > > 0AZ, UK * www.idirect.net<http://www.idirect.net/> * Advancing a > > > Connected World > > > Connect with iDirect: > > > Twitter.com/iDirect<http://twitter.com/idirect> * > > > Facebook.com/iDirect<http://www.facebook.com/idirect> > > > > > > > > > > > >
-- Your bugs , they are afraid of me.
This is the expected behavior. The given timeout should be considered as the maximum time to establish the connection. If Net::SSH2/libssh2/kernel is able to detect the connection can not be established in any way (i.e. an ICMP packet says so, no response to ARP request, no route from the local host, etc) it just aborts instantly.