0

We have a test server which hosts lots of test applications. when there are lots of process (or threads) running, we found new process or thread cannot be created:

  • for C program: "cannot fork, resource unavailable"
  • for java program: it throws exception "OutOfMemory, unable to create native thread"

I think it is due to the hard limit to the maximum number of process. I tried to set ulimit -n 255085. ulimit shows below:

core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
open files                      (-n) 90000
pipe size            (512 bytes, -p) 10
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 255085
virtual memory          (kbytes, -v) unlimited

but it doesn't work. I tried to run many processes at same time with different users and all they stops with same error at same time. therefore, I think there is a "limit" to the whole system regardless to the users logged in.

halfer
  • 19,824
  • 17
  • 99
  • 186
julius ho
  • 1
  • 1
  • This is a confusing question First off it is not a programming question. Second, you need to alter some tunable kernel parameters: maxpid, max_nprocs, and maxuprc. In that order. maxuprc depends utilimately on maxpid. Third, you are actually doing something, it seems, that you should reconsider your approach to. Why? Flooding the system to run lots of processes at the same is almost always a bad idea. – jim mcnamara May 15 '15 at 16:40
  • Does `ps` actually show over 250,000 processes running? And why do you think its a process count problem when the errors all say you are out of memory? – alanc May 15 '15 at 20:34

1 Answers1

2

Your system looks to be out of virtual memory. In such case, there is no point to raise the number of processes.

Increase the swap area size to allow more processes to run.

Make sure you have enough RAM to run all these processes otherwise performance will suffer.

jlliagre
  • 29,783
  • 6
  • 61
  • 72