I have tomcat web app on VPS and the tomcat sometimes (about once a month) crashes with the following error in catalina.out:
Java HotSpot(TM) 64-Bit Server VM warning: Exception java.lang.OutOfMemoryError occurred dispatching signal SIGTERM to handler- the VM may need to be forcibly terminated.
Here are some details about my configuration:
VPS: debian-5.0-x86_64
RAM: 2.5 gb,
virtual processors: 8
HDD: 60gb hdd - 70% free
Tomcat 7.0
java -version:
java version "1.6.0_18" OpenJDK Runtime Environment (IcedTea6 1.8.13) (6b18-1.8.13-0+squeeze1) OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)
Java params: -Xms512m -Xmx1024m
I have also Apache-PHP on that server.
I'm monitoring server load with Munin and it shows me that memory and CPU usage is always stable and there were no any increases before crash.
I'm also logging java memory usage via java.lang.Runtime class, and it shows that jvm always uses max200Mb memory and there were no increase before crash. The last log before crash was 40 seconds ago and that time used memory was: 152Mb.
My web app also runs 6-7 threads that collecting data from different public APIs. These threads start when tomcat is starting, and they always running with periodic sleeps.
Can you please tell me why it crashes? How can I find the reason?