Tomcat7: Out of memory error while executing shutdown.sh

My Tomcat server has been running for several days, but I cannot shut it down normally because shutdown.sh

I got this error on execution :

# root@iZ94hjppdqzZ:~/projects/taolijie# cat hs_err_pid5519.log 
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.
# Possible reasons:
#   The system is out of physical RAM or swap space
#   In 32 bit mode, the process size limit was hit
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Use 64 bit Java on a 64 bit OS
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (os_linux.cpp:2673), pid=5519, tid=3061726064
#
# JRE version:  (8.0_45-b14) (build )
# Java VM: Java HotSpot(TM) Server VM (25.45-b02 mixed mode linux-x86 )
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#

      

So I have to kill Tomcat to shut it down. But the weird thing is that Tomcat was working fine when this error is thrown (it can handle the web request fine).

Here are the VM options:

-server -Xms1G -Xmx1G -XX:+UseG1GC

      

My server has 2 GB of memory. Can anyone figure out what's going on? Thank!!

+3


source to share


1 answer


It looks like you are tweaking your memory configuration:

JAVA_OPTS="-server -Xms1G -Xmx1G -XX:+UseG1GC"

      

The environment variable is JAVA_OPTS

used for all Java Tomcat processes, such as the one used to send the disconnect message.



You need to be sure that you are configuring your Tomcat memory by setting:

CATALINA_OPTS="-server -Xms1G -Xmx1G -XX:+UseG1GC"

      

This setting will only apply to the Tomcat process. Other control processes will run using the default memory settings.

+5


source







All Articles