Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

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.

share|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

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.

share|improve this answer

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.

share|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

 
discard

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.