[ale] What's limiting programs run from /etc/init.d?
Jay Loden
ale at jayloden.com
Mon Aug 6 00:06:25 EDT 2007
Jim Lynch wrote:
> I have a c++ program that fires off a number of threads, each opening a
> tcp socket. It works fine if I run it as root from the command line,
> but it appears that something is limiting the number of tcp sockets that
> can be opened at one time when run as /etc/init.d/program start. I
> looked at ulimit but there doesn't seem to be any applicable limit to
> anything controlled by it.
>
> The limit is in the ~20 open socket range, where I routinely see 30+
> opened by the program run from the command line.
>
> It's only at the start of the program that it opens a bunch of sockets,
> after that it's just a few once in a while.
It's possible that ulimit is still the right place to look. The company I work
for makes network monitoring software so lots of open sockets and file
descriptors can happen. In order to affect the ulimit settings we have to set
the options to ulimit in our init script. Possibly that's what you need to do,
though I'd be surprised if the problem is happening with such a small number of
sockets.
Try setting something like 'ulimit -n xxx' in your init script, where xxx is
something higher than your current number of open files limit reported by ulimit
-a. You could try something really large like 1024 or 2048 and see if that
resolves the problem.
-Jay
More information about the Ale
mailing list