From: Richards, K. <Kei...@Co...> - 2002-08-20 17:56:08
|
Thanks for your reply, which put me on the right track. Yes, you're right. I was believing ulimit, but it was lying to me. It seems that in Solaris, you can increase the fds available to open(), but not fopen(), which is limited to 256. It's a stdio limit for 32-bit apps. Fixes seem to be, rebuild perl with the sfio library. Or rebuild perl as a 64-bit app. I'll give one or other of these a try... Cheers, Keith. > -----Original Message----- > From: Roland Giersig [mailto:Ro...@Gi...] > Sent: 20 August 2002 09:27 > To: Richards, Keith > Cc: 'exp...@li...' > Subject: Re: [Expectperl-discuss] Limit on number of Expect sessions? > > > > 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... > ********************************************************************** This communication is confidential and is intended only for the person to whom it is addressed. If you are not that person you are not permitted to make use of the information and you are requested to notify <mailto:LON...@co...> immediately that you have received it and then destroy the copy in your possession. Commerzbank AG is regulated by the FSA for the conduct of investment business in the UK. ********************************************************************** |