axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Delbecq <delbd+jaka...@oma.be>
Subject Re: Big memory leak of axis in a web environment (ThreadLocal related)
Date Wed, 06 Jun 2007 08:56:06 GMT
Hi,

it's the classes references in cache that are keeping reference to their
class loader (accessible using getClass().getClassloader())

Can somebody explain me what that cache does and what is the correct way
to clean it. The reason i ask this it because of the allocation graph
(see the two allocation graph of 2 offending entries in attachement). I
tracked where the 2 offending classes entries get stored inside that
cache and it looks like the two offending Map.Entry stored in this cache
are a direct result of org.apache.axis.client.Service static initializer
(that is, a static reference to this class triggers the creation of
entries inside the cache that then prevent correct garbage collecting).

So, basically question is,

What is, from caller's point of view, the exact complete call i need to
access this cache (so i can clear it)?

Thank you.


En l'instant précis du 06/06/07 10:23, Rodrigo Ruiz s'exprimait en ces
termes:
> Hi David,
>
> Looking at the code, I see no direct reference to the webapp classloader
> in the class MethodCache. The leaking references may be within the
> contents of the cache map, which can be cleared through the clearCache()
> method.
>
> Try to call MethodCache.getInstance().clearCache() from a context
> listener shutdown() method.
>
>
> Regards,
> Rodrigo Ruiz
>
> David Delbecq wrote:
> > Hello,
>
> > (cross-posting as i don't know if users can answer it or only dev have
> > needed inner knowledge)
>
> > Trying the whole day to locate a memoryleak in our webapplication i
> > finally narrowed it down to what seems an axis bug (see screenshots for
> > help)
>
> > Using heap walker of jprofiler after unloading webapplication, you can
> > see that a Thread (it's a tomcat http thread coming from a reuse thread
> > pool) is keeping a reference to a ThreadLocal that itself keeps a
> > reference to an axis class. (This is how Threadlocal works, it's the
> > Thread that keep the reference to prevent use of time consuming
> > 'synchronized' blocks when accessing value). The axis class itself owns
> > a references to it's webappclassloader, which, as a result, can't be
> > garbage collected and lots of memory (22M in this case) can't be freed.
>
> > You can see in allocation stack that this ThreadLocal was created inside
> > org/apache/axis/utils/cache/MethodCache
> > Looking at this class code
> >
> (http://svn.apache.org/viewvc/webservices/axis/trunk/java/src/org/apache/axis/utils/cache/MethodCache.java?view=markup)
> > i see that there is no way, even by clearing cache, to empty the
> > ThreadLocal (as a reminder, the only way to remove reference from
> > current thread to threadlocal field is to call set(null) on it).
>
> > Now, i am not an expert at axis, all i have is a framework (shark) that
> > use axis as a support library. Maybe this framework is badly configured,
> > resulting in axis sing MethodCache which is not designed for web
> > environment, or maybe it's a bug in MethodCache. Before filling such bug
> > report, i'd like to be sure the use of MethodCache is not mentionned by
> > axis as to "not use in J2EE environments".
>
> > Any help appreciated.
>
> > David Delbecq
>
>
> > ------------------------------------------------------------------------
>
>
> > ------------------------------------------------------------------------
>
>
> > ------------------------------------------------------------------------
>
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org




Mime
View raw message