users@glassfish.java.net

Possible memory leak

From: Ryan de Laplante <ryan_at_ijws.com>
Date: Wed, 24 Oct 2007 13:05:40 -0400

Last week we found that SJSAS 9.1 wasn't running anymore, but the
java.exe process on Windows 2003 Server was using almost 650 MB of
memory. In the log I found that it had run out of memory. I have not
had time to investigate if it is a leak in my own custom JCA connector,
or the app server yet. I will be looking into this in more detail next
week, but thought your team might be interested just in case it is
Glassfish.

Below is the first exception in the log:

[#|2007-10-14T13:22:34.916-0500|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=986;_ThreadName=httpSSLWorkerThread-81-4;_RequestID=7a4db3a9-8ebc-494e-b13e-7dbaef4a7491;|StandardWrapperValve[Faces
Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw
exception
java.lang.OutOfMemoryError: Java heap space
    at java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:39)
    at java.nio.ByteBuffer.allocate(ByteBuffer.java:312)
    at
com.sun.enterprise.web.connector.grizzly.SocketChannelOutputBuffer.realWriteBytes(SocketChannelOutputBuffer.java:130)
    at
org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:851)
    at
org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:149)
    at
org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:626)
    at org.apache.coyote.Response.doWrite(Response.java:599)
    at
org.apache.coyote.tomcat5.OutputBuffer.realWriteBytes(OutputBuffer.java:404)
    at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:417)
    at
org.apache.tomcat.util.buf.C2BConverter.convert(C2BConverter.java:118)
    at
org.apache.tomcat.util.buf.C2BConverter.convert(C2BConverter.java:139)
    at org.apache.coyote.tomcat5.OutputBuffer.write(OutputBuffer.java:510)
    at org.apache.coyote.tomcat5.CoyoteWriter.write(CoyoteWriter.java:230)
    at org.apache.coyote.tomcat5.CoyoteWriter.write(CoyoteWriter.java:239)
    at
com.sun.faces.application.ViewHandlerImpl$WriteBehindStateWriter.write(ViewHandlerImpl.java:834)
    at
com.sun.faces.renderkit.html_basic.HtmlResponseWriter.write(HtmlResponseWriter.java:495)
    at
com.sun.faces.renderkit.html_basic.TextRenderer.getEndTextToRender(TextRenderer.java:158)
    at
com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:204)
    at
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:896)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
    at
com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:245)
    at
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:176)
    at
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:285)
    at
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
    at
org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
|#]

After that I see one of these every 5-10 minutes, which is from my
custom JCA connector:

[#|2007-10-14T13:23:12.733-0500|SEVERE|sun-appserver9.1|javax.enterprise.resource.resourceadapter|_ThreadID=35;_ThreadName=Timer-6;_RequestID=ffbb88a8-2425-482a-a87b-d81ebca76dac;|RAR5038:Unexpected
exception while creating resource
javax.resource.ResourceException:


There are almost 100 connection pools set up for this connector. They
are configured to have minimum 1, max 15, resize count 1, timeout 5 minutes.


Ryan