I am trying to allocate ram with xms = xmx on a sles10 x64 running under VMware.
When stopping the JVM the following error is thrown:
Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 12).
The RAM of the VM is 8 GB and they are reserved.
The VM sees 8GB and it can be allocated during runtime via the XMX setting.
On another Virtual SLES10 with 16 GB RAM Reserved via VMWare I don't have a problem with allocation of RAM even when setting the hugepages and shmax only by echo it works fine.
echo 8000 > /proc/sys/vm/nr_hugepages
echo 8589934592 > /proc/sys/kernel/shmmax
Using the echo commands on the other SLES10 show no effect in /proc/meminfo at all.
here are my configs 1st on is the SLES10 where XMS fails to allocate.
开发者_如何学JAVA# more /apps/liferay-portal-5.2.5/tomcat-5.5.27/bin/setenv.sh JAVA_HOME=/apps/java5 JRE_HOME=/apps/java5 JAVA_OPTS="$JAVA_OPTS -Xms3G -Xmx3G -XX:NewRatio=3 -XX:MaxPermSize=256m -XX:SurvivorRatio=20 -Dsun.rmi.dgc.client.gcInterval=1800000 -Dsun.rmi.dgc.server.gcInterval=1800000 -XX:+UsePa rallelGC -XX:ParallelGCThreads=4 -XX:+UseLargePages -Xloggc:/apps/gc.log -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGC -XX:+PrintGCTimeStamps - XX:+PrintGCDetails -Dfile.encoding=UTF8 -Duser.timezone=GMT+2 -Djava.security.auth.login.config=$CATALINA_HOME/conf/jaas.config -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_C LEAR_REFERENCES=false" more /etc/sysctl.conf kernel.shmmax=7516192768 vm.nr_hugepages=3072 vm.hugetlb_shm_group=1000 more /etc/securtiy/limits.conf # # #* soft core 0 #* hard rss 10000 #@student hard nproc 20 #@faculty soft nproc 20 #@faculty hard nproc 50 #ftp hard nproc 0 #@student - maxlogins 4 * soft memlock unlimited * hard memlock unlimited tomcat soft memlock 6291456 tomcat hard memlock 6291456 # End of file # cat /proc/meminfo MemTotal: 7928752 kB MemFree: 737004 kB Buffers: 0 kB Cached: 417368 kB SwapCached: 0 kB Active: 487428 kB Inactive: 324072 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 7928752 kB LowFree: 737004 kB SwapTotal: 2097144 kB SwapFree: 2097020 kB Dirty: 0 kB Writeback: 0 kB AnonPages: 397208 kB Mapped: 72180 kB Slab: 62136 kB CommitLimit: 2915792 kB Committed_AS: 748576 kB PageTables: 3292 kB VmallocTotal: 34359738367 kB VmallocUsed: 7028 kB VmallocChunk: 34359731271 kB HugePages_Total: 3072 HugePages_Free: 2305 HugePages_Rsvd: 897 Hugepagesize: 2048 kB # ipcs -l Shared Memory Limits -------- max number of segments = 4096 max seg size (kbytes) = 7340032 max total shared memory (kbytes) = 4611686018427386880 min seg size (bytes) = 1 Semaphore Limits -------- max number of arrays = 1024 max semaphores per array = 250 max semaphores system wide = 256000 max ops per semop call = 32 semaphore max value = 32767 Messages: Limits -------- max queues system wide = 16 max size of message (bytes) = 65536 default max size of queue (bytes) = 65536 # ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited pending signals (-i) 65536 max locked memory (kbytes, -l) unlimited max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 65536 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited
On the Second VM it looks like this
cat /proc/meminfo MemTotal: 16190448 kB MemFree: 176812 kB Buffers: 52752 kB Cached: 755256 kB SwapCached: 0 kB Active: 713808 kB Inactive: 425300 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 16190448 kB LowFree: 176812 kB SwapTotal: 35658896 kB SwapFree: 35658796 kB Dirty: 932 kB Writeback: 0 kB AnonPages: 333620 kB Mapped: 79120 kB Slab: 37492 kB CommitLimit: 36356744 kB Committed_AS: 646284 kB PageTables: 3584 kB VmallocTotal: 34359738367 kB VmallocUsed: 23500 kB VmallocChunk: 34359713907 kB HugePages_Total: 7224 HugePages_Free: 6654 HugePages_Rsvd: 582 Hugepagesize: 2048 kB JAVA_OPTS="$JAVA_OPTS -Xms2G -Xmx2G -XX:NewRatio=3 -XX:MaxPermSize=256m -XX:SurvivorRatio=20 -Dsun.rmi.dgc.client.gcInterval=1800000 -Dsun.rmi.dgc.server.gcI nterval=1800000 -XX:+UseParallelGC -XX:ParallelGCThreads=2 -XX:+UseLargePages -Xloggc:/apps/gc.log -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplication ConcurrentTime -XX:+PrintGC -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Dfile.encoding=UTF8 -Duser.timezone=GMT+2 -Djava.security.auth.login.config=$CATALINA _HOME/conf/jaas.config -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false" hepide01pep1:~ # ipcs -l ------ Shared Memory Limits -------- max number of segments = 4096 max seg size (kbytes) = 8388608 max total shared memory (kbytes) = 4611686018427386880 min seg size (bytes) = 1 ------ Semaphore Limits -------- max number of arrays = 1024 max semaphores per array = 250 max semaphores system wide = 256000 max ops per semop call = 32 semaphore max value = 32767 ------ Messages: Limits -------- max queues system wide = 16 max size of message (bytes) = 65536 default max size of queue (bytes) = 65536
Did you tried with the less size of heap.. may be with 2gig. You can just do simple try with java -Xmx3G -version .Let us know how it goes and what it spit out.
I have stumbled with this issue (errno 12) on CentOS 5.9 as well using 16G heaps.
After verifying hard / soft memory locks were unlimited in /etc/security/limits.conf and still getting the error, I started running java -version as suggested by Anil, with all of my JAVA_OPTS intact.
I have found that removing the "-XX:+UseLargePages" option gets rid of that error.
I hope this helps you!
精彩评论