From: Roland G. <Ro...@Gi...> - 2002-08-20 08:26:40
|
> I'd like to maintain a number of simultaneous ssh connections from > one host to maybe 300 others. I've been looking at using Perl > Expect for this, and it's been working well for small numbers > of connections. > > This script: > > #!/usr/local/bin/perl -w > use Expect; > @exps = (); > for $i (1 .. 300) { > print "$i\n"; > my $exp = new Expect; > $exp->log_stdout(0); > $exp->spawn("ssh gend51"); > my $match = $exp->expect(30, "gend51> "); > push(@exps, $exp); > } > > falls over when it hits 251, with the error: > > Cannot open pipe: Illegal seek at > /usr/local/lib/perl5/site_perl/5.6.0/Expect.pm line 105. > > I guess this is something to do with limited file descriptors, but > I've upped my fd limit (as reported by ulimit -n and limit > descriptors) to 1024, and no change. Are you sure about that? Have you tried with a simple script that just opens files and counts how many can be opened? Let's count the fds: stdin/out/err are 3, plus 250 open ptys gives 253; when spawning, Expect creates a pty/tty pair, makes 255, and then creates an anonymous pipe with 2 fd, which pushes the total count over 256, so this seems to be the limit, and it looks like a system limit. As the default Solaris fd limit is 256, this seems the most plausible explanation, as I don't think that there is a hard limit like that in the perl interpreter (there is definitely no limit in Expect). Maybe you are running under a different user with a different limit? > I'm on Solaris 8, perl 5.6.0, Expect 1.15, 2GB RAM, 8GB swap. > > Any thoughts about how to avoid the above problem? Upgrading to 5.6.1 might help, but this is a rather long shot. Hope this helps, Roland -- Ro...@Gi... |