I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2011-02-22 10:04:57.17872-08 by shawnohail
Timeout parameter not working
I'm working on a script to SSH to an IOS device using N::A::S v2.110090. It issues the command 'show mac-address-table dynamic'. On particularly large switches it takes a very long time to get the response back. Using the default timeout nets me about 10s (+3s to startup and login) before the command times out:
my $s = new Net::Appliance::Session ( Host => 'XXXXXX' ); $s->connect( Name => 'XXX', Password => 'XXX' ); printf "Timeout is %d\n", $s->timeout(); my @r = $s->cmd( 'show mac-address-table dynamic' );

Command output:
> time ./timeout.pl Timeout, EOF or other failure waiting for command response at ./timeout.pl line 13 Timeout is 10 ./timeout.pl 8.56s user 0.04s system 63% cpu 13.440 total

Adjusting the timeout to 120 seconds does not net me 120 seconds of wait time like I believe it should:
my $s = new Net::Appliance::Session ( Host => 'XXXXXX', Timeout => 120 );

Command output:
> time ./timeout.pl Timeout, EOF or other failure waiting for command response at ./timeout.pl line 13 Timeout is 120 ./timeout.pl 47.51s user 0.06s system 89% cpu 53.268 total

Changing the timeout to 240 yeilds the same result as 120. Changing the timeout via cmd() gives me the same result
$s->cmd( String => 'show mac-address-table dynamic', Timeout => 120 );
Command output:
> time ./timeout.pl Timeout is 10 Timeout, EOF or other failure waiting for command response at ./timeout.pl line 13 ./timeout.pl 46.53s user 0.07s system 89% cpu 51.875 total


Has anyone else had luck with changing the timeout? Am I missing something obvious? I hope so....
Direct Responses: 13211 | Write a response
Posted on 2011-02-23 03:34:50.915336-08 by raimundh in response to 13210
Re: Timeout parameter not working
Hi Is your buffer not perhaps filling up? If you're getting back a large amount of data, increasing the timeout may not be enough. I have a script that gets back some massive configs from a device, and I've found I had to increase the buffer as well as the timeout:
use constant { TIMEOUT => 900, MAXBUFFER => 4194304 # the default buffer is 1048576 bytes - not big enough... } my $session = Net::Appliance::Session->new( Timeout => TIMEOUT, Input_log => $logDir, Host => $device, Transport => 'SSH', ); $session->max_buffer_length(MAXBUFFER);
Give something like that a try and see if it helps...
Direct Responses: 13215 | Write a response
Posted on 2011-02-23 11:32:55.471683-08 by shawnohail in response to 13211
Re: Timeout parameter not working
You are the man, that worked. Thank you so much!
Direct Responses: 13219 | Write a response
Posted on 2011-02-24 00:11:25.957505-08 by raimundh in response to 13215
Re: Timeout parameter not working
:) No problem, glad to be of assistance. That problem was doing my head in when I first encountered it.
Direct Responses: Write a response