Mohan Cheema's Online Diary

Site Just to Keep Track of My Day to Day Work.

Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 12)

| 2 Comments

I was configuring Apache Tomcat on 64-Bit Linux OS and wanted to tune it for better performance. While searching the net for the same I came across JVM Performance Tuning by Andrig Miller its good start for tuning Java for better performance on machine with Large memory.

Everything went fine but for some reason the process was not able to make the use of HugePages. Did lot of googling but was able to find the answer why it was not using it and to top it up whenever I use to shut down the server I use to get following error:

Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 12)

Hence tried to do the research on my own. First thing I did is reduce the heap size that I had defined by 1 GB which resolved both the issues (Initially I have define the heap size same as memlock defined in /etc/security/limits.conf). Other thing that you can do is set the memlock to unlimited. Thanks to Andrig Miller for the suggestion.

Edit /etc/security/limits.conf and change the memlock as follows:

soft memlock unlimited
hard memlock unlimited

Conclusion: Keep the Heap Size less than the memlock defined in /etc/security/limits.conf. Or set the memlock to unlimited in /etc/security/limits.conf

Share

Author: Mohan Cheema

I am a Commerce Graduate currently I am working as Senior Support Analyst (Linux Administrator) with medium sized MNC Company. If time permits I do freelance work like setting up the servers as per the requirement, do performance tuning and so on.

2 Comments

  1. I have change it to unlimited,but the error repeat.

  2. Hi,

    Can you post the content of your limits.conf, output of ulimit -a and memory you have assigned to your JVM.

    Regards,

    Mohan

Leave a Reply

Required fields are marked *.

*

* Copy this password:

* Type or paste password here:

2,895 Spam Comments Blocked so far by Spam Free Wordpress


CommentLuv badge

Notify me of followup comments via e-mail. You can also subscribe without commenting.