4

I have a memory problem with a Linux server (CentOS). It is a VM. Below is the context.

It has 70Gb of RAM. There are 2 tomcat running on it.

One tomcat is given a heap of 13Gb and the other one a heap of 20Gb.

The one with 20Gb has the JVM option -Xss160k set (to try to solve my problem).

These 2 tomcat can be using up to 48Gb of RAM (virt.)

Linux is going to use the 70Gb and there will be about 35Gb of cached memory. The swap is 1Gb and it uses pretty much none of it (8Mb).

Now the problem is that I get the following error from the tomcat every so often:

OutOfMemoryError: unable to create new native thread

If I am not mistaken, this happens if the OS itself runs out of memory and is therefore unable to create new threads.

Now the question is: how is that possible when it has 35Gb of cached memory? Shouldn't it re-allocate it and use it as needed.

Is there maybe some kernel option I can set to avoid this? For example it could use up to 65Gb, cache 30Gb and keep 5Gb free.

2

This may be a question of limits set with ulimit. As the user running tomcat, do

ulimit -a

In the output, look for the line max user processes.

max user processes              (-u) 1024

Try raising that value, e.g. ulimit -u 4096, before starting tomcat.

| improve this answer | |
  • I will try it out but I don't think it is the problem. I have another server (solaris) which does the exact same job and max user processes is 1024 and I have no problem there. – ttux Apr 15 '13 at 14:29
  • Use ps -eLf |grep #^tomcatuser|wc-l to count the number of process (including threads) – Franklin Piat Mar 16 '15 at 6:20
2

I found out how to make sure I have X amount of RAM available:

sysctl -w vm.min_free_kbytes=...

I don't know yet if that will solve my problem or if Jenny D answer will.

| improve this answer | |
  • So how was the issue fixed? – jlliagre Sep 13 '15 at 12:02
1

What is the value for Xms,Xmx,PermSize MaxPermSize in your Catalina file ? Normally, I have seen adjusting these parameters avoids the JVM OutofMemory Issues.

| improve this answer | |
  • If the OutOfMemory is due to PermGen or Heap Space then yes you are correct. That is not my case here. – ttux Apr 18 '13 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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