in reply to Re^2: Working around limit to number of connections vis Net::OpenSSH
in thread Working around limit to number of connections with Net::OpenSSH

Looking at the code excerpt you have posted, it seems unlikely that you need the 256 files opened simultaneously. Probably, your code or some of the modules you are using or the OpenSSH binary is leaking file descriptors in some way.

Increasing the available file descriptors is just going to hide and delay the issue but not to solve it.

Net::OpenSSH has a debug mode you can enable setting $Net::OpenSSH::debug=-1, and you can also pass the flags -vvv to the ssh client in order to find where your program is failing.

Replies are listed 'Best First'.
Re^4: Working around limit to number of connections vis Net::OpenSSH
by nysus (Parson) on Mar 28, 2017 at 10:42 UTC

    I agree. I'm just happy to figure out why the code wasn't working. Ideally I'd like for the new file objects to re-use an existing Net::OpenSSH object or destroy existing objects that use the connection. I'm currently trying to figure out how to do that.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks

      You should be able to reuse the Net::OpenSSH object/connection as many times as you like.

      AFAIK, nor the module, neither ssh leak file descriptors, so the issue is probably in your code...