Only1KW has asked for the wisdom of the Perl Monks concerning the following question:
I currently am running a script that, among other things, runs ssh commands on remote systems and processes the output. This script had been running fine as of July 8, but recently it appears to have just frozen. Looking at the log that the script prints to, it seems to have stopped at August 9 at ~4:15 AM while trying to scan a system via SSH. Running ps, I see the following:
root 15347 15339 15261 0.0 1.2 57984 48320 ? S Jul08 + 4:37 /usr/bin/perl /srv/www/cgi-bin//sysManager.pl /srv/www/cgi-b +in/ root 18773 18773 18773 0.0 0.2 12352 8576 pts/0 Ss+ Aug09 + 0:00 ssh -xMN -o NumberOfPasswordPrompts=1 -o PreferredAuthenti +cations=keyboard-interactive,password -S /root/.libnet-openssh-perl/h +scroot-[hostnameRemoved]-15347-95046 -o User=[usernameRemoved] -- [ho +stnameRemoved] root 18775 15339 15261 0.0 0.2 12096 8064 ? S Aug09 + 0:00 ssh -S /root/.libnet-openssh-perl/[usernameRemoved]-[hostn +ameRemoved]-15347-95046 -o User=[usernameRemoved] -- [hostnameRemoved +] [cmdRemoved]
The lines of code that equate to this scan are:
my $ssh = Net::OpenSSH->new($host, (user => $username, password => $pa +ssword, timeout=>30)); my($stdout, $stderr) = $ssh->capture2({timeout => 30}, $cmd);
Is there any way to debug what may have happened here and why it didn't time out, in the hopes that I can avoid this in the future or submit a bug report? I see it says in the Net::OpenSSH documentation regarding the "timeout" parameter that "As the Secure Shell protocol does not support signalling remote processes, in order to abort the remote process its input and output channels are closed. Unfortunately this aproach does not work in some cases." Is there another way to force this timeout? I've tried running the script again and didn't hit the problem this time, but am guessing it will happen again randomly later and don't want to have to manually restart the script every time it does.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::OpenSSH cmd not timing out as requested
by pileofrogs (Priest) on Aug 11, 2010 at 18:04 UTC | |
by Only1KW (Sexton) on Aug 11, 2010 at 22:20 UTC | |
|
Re: Net::OpenSSH cmd not timing out as requested
by salva (Canon) on Aug 12, 2010 at 08:07 UTC |