Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a java app on a large instance that will spawn up to 800 threads. I can run the application fine as user "root" but not as another user which I created. I get the deadly.

java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(
at java.util.concurrent.ThreadPoolExecutor.addWorker(
at java.util.concurrent.ThreadPoolExecutor.execute(

nightmare. I have tried increasing the stack size already in limits.conf to no avail. Please, help me out. What is different here for the root and other user?

share|improve this question
Take a look at the output of ulimit -a for each user and see if there are any notable differences. – cyberx86 Feb 2 '12 at 0:13
They are exactly the same. and thats what bugs me – vinchan Feb 2 '12 at 0:27
Have you tried java -Xmx1024m yourapp ? – gabrielhpugliese Feb 2 '12 at 2:14
I'd recommend using strace to identify the underlying native call that's throwing an error so you can know exactly what you're looking at. – Kyle Smith Feb 2 '12 at 3:54
I think it will be helpful if you tell us more about your hardware/OS – Khaled Feb 2 '12 at 9:15

For some reason, setting the max number of processes higher seems to solve it, although I am sure there is only one process running with a lot of threads. Posting my final configs.

$ ulimit -u 81920

$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 59377
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 100000
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) 81920
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
share|improve this answer
Linux threads do consume process IDs, so this behaviour is quite normal. – Hubert Kario Feb 3 '12 at 23:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.