in reply to fork more than MaxSessions times in Net::OpenSSH
As a workaround, the following hack seems to work, just making the command fail:
After the capture method call, in case of too many session, $ssh->error will be OSSH_SLAVE_CMD_FAILED and $? == 255.my $ssh = Net::OpenSSH->new( $host ); push @{$ssh->{_ssh_opts}}, '-oConnectionAttempts=0'; ...
I will add some option to the constructor to allow for setting slave ssh arguments without fiddling with the object interiors.
Anyway, instead of forking and unlimited number of processes, you could also use Parallel::ForkManager or Proc::Queue to get it under control.
update: I have just released version 1.53_04 that allows to set default slave ssh options as follows:
my $ssh = Net::OpenSSH->new($host, default_ssh_opts => [-o => 'ConnectionAtte +mpts=0'], ...);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: fork more than MaxSessions times in Net::OpenSSH
by morya (Initiate) on Sep 02, 2011 at 08:06 UTC |