Subject: | Deep recursion in Net::Appliance::Session 1.36 |
Date: | Mon, 18 Jan 2010 15:45:07 -0000 |
To: | bug-Net-Appliance-Session [...] rt.cpan.org |
From: | "Campbell, Steve" <Steve.Campbell [...] virginmedia.co.uk> |
Hi,
I've come across a replicatable error message as follows:
"Deep recursion on subroutine "Net::Appliance::Session::cmd" at
/opt/perllib/Net/Appliance/Session/Engine.pm line 37. "
I get this when running a command which generates a huge amount of
output, after disabling paging.
What is happening is that the command is timing out, and the eval in
Net::Telnet::waitfor() is calling close().
The close calls enable_paging().
Enable_paging() calls cmd() with the paging command.
Cmd() calls waitfor()
This fails as the device hasn't finished the original command yet. The
eval then calls close() and we go into a death spiral.
The fix is add the accessor close_called, and add the following lines to
close() -
# Ensure we don't go into a loop if the clean up commands fail.
return if $self->close_called;
$self->close_called(1);
The original command still fails, but at least we now get a meaningful
time out message!
Next things I'm looking are to fix waitfor() such that
* Pattern matches are only done on the last line of output, to avoid
performance costs going exponential with large command outputs. Hmm.
This got reported and rejected in 2003.
* Reset the timeout clock whenever it receives more data
* Allow waitfor to squirt out the data as it gets it, instead of having
to wait until the command ends.
Of course, these aren't your concern, but you might be interested...
Thanks,
Steve
------------------------------------------------------------------------------
Save Paper - Do you really need to print this e-mail?
Visit www.virginmedia.com for more information, and more fun.
This email and any attachments are or may be confidential and legally privileged
and are sent solely for the attention of the addressee(s). If you have received this
email in error, please delete it from your system: its use, disclosure or copying is
unauthorised. Statements and opinions expressed in this email may not represent
those of Virgin Media. Any representations or commitments in this email are
subject to contract. Please note that we are migrating our email addresses to a
company wide address of "@virginmedia.co.uk". If you are sending to a Telewest or
ntl email address your email will be re-directed.
Registered office: 160 Great Portland Street, London W1W 5QA.
Registered in England and Wales with number 2591237
==============================================================================