We are running a ruby on rails app under jruby in a tomcat 6 container,
after 4
weeks of uptime we have run encountered an
OutOfMemoryError java heap space.
SEVERE: Exception invoking periodic operation:
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at java.lang.StringCoding.safeTrim(StringCoding.java:64)
at java.lang.StringCoding.access$300(StringCoding.java:34)
at
java.lang.StringCoding$StringEncoder.encode(StringCoding.java:251)
at java.lang.StringCoding.encode(StringCoding.java:272)
at java.lang.String.getBytes(String.java:946)
at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
at
java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:228)
at java.io.File.exists(File.java:733)
at
org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1113)
at
org.apache.catalina.startup.HostConfig.check(HostConfig.java:1342)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.ja
va:119)
at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337
)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChild
ren(ContainerBase.java:1601)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChild
ren(ContainerBase.java:1610)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(Containe
rBase.java:1590)
at java.lang.Thread.run(Thread.java:662)
After examining the heap dump we have discovered that around 600
megabytes of
heap was consumed as below :
org.quartz.simpl.SimpleThreadPool$WorkerThread
-> org.joni.ByteCodeMachine
–> org.joni.StackEntry | Shallow Heap = 67,108,880 | Retained Heap =
593,721,520
My thoughts are that our quartz scheduler starts a jruby runtime each
time its
invoked that isn’t being cleaned up.
Just wanted to know what the StackEntry class (Is it a Jruby runtime)
and
why it isn’t being cleaned up …