Thursday, November 22, 2012

Memory Leak caused by ThreadLocalMap - The suspect is com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet

Hi,


In my project I am using using gwt-2.4.0. The server side business wrapper extends com.google.gwt.user.server.rpc.RemoteServiceServlet, deployed on WebSphere Application Server7 (JDK1.6, with JEE5 compliance).
I have a memory leak on the server side (I expected low memory usage values due to the stateless approach with GWT as opposite to JSF for example - one of the main reasons why I used GWT in the first place). After analyzing the heap dumps the cause is java.lang.ThreadLocal$ThreadLocalMap$Entry with over 400.000 entries.
Dinging to find the reason I have come across other people experiencing similar situations caused by the usage of ThreadLocal in a improper manner.
See: http://stackoverflow.com/questions/3984256/lots-of-threadlocalmap-entries-in-memory and http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6625723

The current implementation of com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet uses two instances of ThreadLocal to wrap the HttpServletRequest and HttpServiceResponse objects. (both are not static; couldn't see any calls to remove; "this" is in the sychronized block - couple of things that triggered my suspicions).

Did anybody faced similar issues?


With thanks,
Tiberiu



--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/hdm8oG1woXwJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment