Message Boards

There is insufficient memory for the Java Runtime Environment to continue

srini vasulu, modified 3 Years ago.

There is insufficient memory for the Java Runtime Environment to continue

Regular Member Posts: 139 Join Date: 2/22/11 Recent Posts

Hi,

did any one facing same type of issue? and is there any solution for below issue.

We are using liferay 7.0.4 GA5 version 

Java Version:openjdk version "1.8.0_275" 64 bit.

OS:ubuntu 18.04

In setenv.sh

CATALINA_OPTS="$CATALINA_OPTS -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xms40960m -Xmx40960m -XX:MaxPermSize=8192m"

facing below error. and we are not able to access getting the 502 error in brow.

22:45:01,866 WARN  [HikariPool-1 housekeeper][HikariPool:676] HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=1m46s466ms209µs39ns).
22:45:01,866 WARN  [HikariPool-2 housekeeper][HikariPool:676] HikariPool-2 - Thread starvation or clock leap detected (housekeeper delta=1m46s470ms34µs328ns).
22:45:02,154 WARN  [elasticsearch[Commander Kraken][scheduler][T#1]][jvm:175] [Commander Kraken] [gc][young][860233][352] duration [22.9s], collections [1]/[1.2m], total [22.9s]/[6.7m], memory [4.4gb]->[1.1gb]/[38.3gb], all_pools {[young] [3.3gb]->[3.1mb]/[12.8gb]}{[survivor] [0b]->[0b]/[248mb]}{[old] [1.1gb]->[1.1gb]/[26.6gb]}
22:45:02,197 WARN  [elasticsearch[Commander Kraken][scheduler][T#1]][jvm:175] [Commander Kraken] [gc][old][860233][244] duration [53.5s], collections [1]/[1.2m], total [53.5s]/[14.2m], memory [4.4gb]->[1.1gb]/[38.3gb], all_pools {[young] [3.3gb]->[3.1mb]/[12.8gb]}{[survivor] [0b]->[0b]/[248mb]}{[old] [1.1gb]->[1.1gb]/[26.6gb]}
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00007f60fc62b000, 12288, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 12288 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /opt/liferay/liferay-ce-portal-7.0-ga5/tomcat-8.0.32/hs_err_pid3547.log
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=8192m; support was removed in 8.0
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00007f1ffd000000, 28633464832, 0) failed; error='Cannot allocate memory' (errno=12)
#

thumbnail
Christoph Rabel, modified 3 Years ago.

RE: There is insufficient memory for the Java Runtime Environment to contin

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts

Remove "-XX:MaxPermSize=8192m", 8192m is a totally bogus value, 384m or maybe 512m makes some sense, but 8192m is far too much. It is ignored anyway, it seems, but still.

How much memory and swap space does your server have? I'd recommend to not go to the "limit" of the server. If you have 4GB Ram, you probably can't give Liferay 4GB. If you have 8 GB, 4 GB is probably fine.

Is there other stuff on the server that needs memory? e.g. Elasticsearch, database, other applications, ...

 

srini vasulu, modified 3 Years ago.

RE: RE: There is insufficient memory for the Java Runtime Environment to co

Regular Member Posts: 139 Join Date: 2/22/11 Recent Posts

Hi christoph,

I changed to "-XX:MaxPermSize=1024m", (i am going remove the -XX:MaxPermSize) and my ram size 64GB and we allocated -Xms20480m -Xmx20480m - X:MaxPermSize=1024m"
20480 (20 GB ) and still we are getting the same issue.

 free -m
              total        used        free      shared  buff/cache   available
Mem:          64424        8962       52359           1        3101       54837
Swap:        131071           0      131071
we given swap also very good amount of space.

# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 12288 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /opt/liferay/liferay-ce-portal-7.0-ga5/tomcat-8.0.32/hs_err_pid2328.log
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=1024m; support was removed in 8.0

can we set the below java_opts in setenv.sh in liferay 6.2 we set this below parameter

JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF8 -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xmx16392m -XX:MaxPermSize=512m -Djava.net.preferIPv4Stack=true"

/opt/liferay/liferay-ce-portal-7.0-ga5/tomcat-8.0.32/hs_err_pid2328.log from this file starting part 
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 12288 bytes for committing reserved memory.
# Possible reasons:
#   The system is out of physical RAM or swap space
#   The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
#   JVM is running with Zero Based Compressed Oops mode in which the Java heap is
#     placed in the first 32GB address space. The Java Heap base address is the
#     maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
#     to set the Java Heap base and to place the Java Heap above 32GB virtual address.
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (os_linux.cpp:2792), pid=2328, tid=0x00007fbc7f540700
#
# JRE version: OpenJDK Runtime Environment (8.0_275-b01) (build 1.8.0_275-8u275-b01-0ubuntu1~18.04-b01)
# Java VM: OpenJDK 64-Bit Server VM (25.275-b01 mixed mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#

---------------  T H R E A D  ---------------

Current thread (0x00007fbcc000a000):  JavaThread "HikariPool-2 connection adder" daemon [_thread_new, id=4514, stack(0x00007fbc7f440000,0x00007fbc7f541000)]

Stack: [0x00007fbc7f440000,0x00007fbc7f541000],  sp=0x00007fbc7f53fb00,  free space=1022k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xb6b032]
V  [libjvm.so+0x4f1627]
V  [libjvm.so+0x991536]
V  [libjvm.so+0x9886fe]
V  [libjvm.so+0x992aa7]
V  [libjvm.so+0xb08206]
V  [libjvm.so+0xb08440]
V  [libjvm.so+0x98eb62]
C  [libpthread.so.0+0x76db]  start_thread+0xdb

 

 

 

thumbnail
Olaf Kock, modified 3 Years ago.

RE: There is insufficient memory for the Java Runtime Environment to contin

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts

First things first: If you still want to be on 7.0, you should be on a patched 7.0 GA7.

Next: Is there any reason why you're allocating that humongous amount of memory? My rule of thumb is: Never let a server run into virtual memory - that will certainly kill your performance in a non-reproducible way. Humongous amounts of unrequired memory also might just lead to less frequent but fatal GC runs - I prefer frequent but quick GC runs.

Also: Do not use JAVA_OPTS to set your memory options for tomcat. You want to use CATALINA_OPTS: Those are only used for starting a server. JAVA_OPTS would also be used for the shutdown.sh script - and there you'd be happy with minimum memory for the second that it runs.

I'm looking at the error message you quote, which says: "JVM is running with Zero Based Compressed Oops mode in which the Java heap is placed in the first 32GB address space. The Java Heap base address is the maximum limit for the native heap growth." - whatever also populates the first 32GB address space will also limit what Java can allocate there - sometimes all of the virtual memory still references the actual physical infrastructure these days.

You might also want to set -Xms to the same value as -Xmx - this way the JVM allocates its memory immediately at startup, and you'll see immediately if it can do so, not just after days of operation when it tries to allocate more of the allowed maximum.

But, in general: If you don't have a really good (measured) reason: Don't aim high. Find the lowest amount of memory you can safely run on, and add a bit of safety margin. Don't try to allocate all of a machine's RAM just because you have it.

srini vasulu, modified 3 Years ago.

RE: RE: There is insufficient memory for the Java Runtime Environment to co

Regular Member Posts: 139 Join Date: 2/22/11 Recent Posts

Hi Olaf,

We found the issue. issue is because of libreoffice occupying the 98% memory and for liferay there is no memry and we are facing issue. is there any way to set the memory limit to lifbreoffice. we are using lot off files in that server newarly 1TB data in document and library.