[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: AW: Still much more than 350 sockets needed!

On Thursday 27 April 2006 01:01pm, Olivier Galibert wrote:
> On Thu, Apr 27, 2006 at 12:32:01PM -0600, Lamont R. Peterson wrote:
> > So, unless they are running their client app as root, ulimit -n will not
> > work.
> In fact, no.  ulimit is stupid, that's all, in that it changes both
> soft and hard limit when going down.  But if as root you change the
> hard limit to 2048 without touching the soft one then start a user
> shell, you'll see that you can raise your limit with ulimit -n 2048,
> but if you ever reduce it you can't raise it again.

Well, I tried that on SLES9 and FC5 (which both happen to be handy at the 
moment) and that didn't work.  An unprivileged user can not run ulimit -n, 

Also, why would you set the hard limit so low?

FC5 does not have default limits set, so I'm not sure where it gets 1024 as 
the default soft limit.  From bash (not likely)?  From glibc (also not 
likely)?  From the kernel (probably; found in fs.h, perhaps)?

A quick test (run as root):

for i in $(seq 16 21); do
   ulimit -n $(echo "2^${i}" | bc -l)
   ulimit -aH | grep "open files"


open files                      (-n) 65536
open files                      (-n) 131072
open files                      (-n) 262144
open files                      (-n) 524288
open files                      (-n) 1048576
-bash: ulimit: open files: cannot modify limit: Operation not permitted
open files                      (-n) 1048576

I'm sure that's not an exact test, but it was quick.

> (t)csh limit changes only the soft limit unless you add -h.

Yeah.  I love (t)csh.  But then, I'm a programmer at heart. :)
Lamont R. Peterson <lamont gurulabs com>
Senior Instructor
Guru Labs, L.C. [ http://www.GuruLabs.com/ ]
GPG Key fingerprint: F98C E31A 5C4C 834A BCAB  8CB3 F980 6C97 DC0D D409

Attachment: pgp6m4FMwUx2h.pgp
Description: PGP signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]