tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: WebappClassLoader weak/soft reachable
Date Tue, 06 Nov 2012 19:30:03 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Konstantin,

On 11/6/12 10:37 AM, Konstantin Kolinko wrote:
> 2012/11/6 Christopher Schultz <chris@christopherschultz.net>:
>> 
>> I was playing around with the manager webapp today and just for 
>> grins, I redeployed my webapp and then hit the "Find Leaks" 
>> button to see how long it would take Tomcat to decide that my 
>> webapp reloads cleanly.
>> 
>> It didn't. That is, my webapp does not appear to cleanly reload. 
>> Which was a surprise to me.
>> 
>> I waited a few moments and tried again: Find Leaks still says 
>> "there's a leak, confirm with a profiler". So I attached with 
>> YourKit, took a memory snapshot and started looking around: I 
>> found 4 WebappClassLoaders (1 for manager, 1 for my webapp, 1
>> for a dummy ROOT webapp I have and finally a started=false 
>> WebappClassLoader for the old pre-reload of my webapp).
>> 
>> Interestingly, the started=false WebappClassLoader says that it 
>> is Weak/Soft Reachable. That means that tracing GC roots doesn't 
>> really work.
>> 
>> Requesting GC via the manager changes nothing. Requesting GC via 
>> the profiler changes nothing.
>> 
>> Does anyone have any good ideas for tracking-down what is
>> keeping this WebappClassLoader in memory? Do I just have to
>> intentionally exhaust the heap to convince the MM/GC that it
>> should toss-out this WCL?
>> 
>> Any suggestions would be greatly appreciated.
>> 
> 
> 1) There exists an -X option that disables explicit GC calls. I 
> hope that you are not using it.

No, I don't do any of that foolishness.

> 2) I know of a bug in JVM when a certain kind of leak goes 
> undetected. I mean the leak through a shared Exception instance
> and its native stacktrace. See
> 
> https://issues.apache.org/bugzilla/show_bug.cgi?id=50460 
> https://issues.apache.org/bugzilla/show_bug.cgi?id=53936 (Linked 
> from https://wiki.apache.org/tomcat/MemoryLeakProtection)

I don't create any of my own Exception objects that get shared. Could
this be something introduced by Tomcat itself, or more likely some
dependent library of mine?

Since I can't readily trace the WebappClassLoader to its GC roots, do
you have any suggestions for identifying the specific cause in my case?

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlCZZTsACgkQ9CaO5/Lv0PCcvgCgh3/8/66jfTVNzsTtd2M1S8vY
Ze4An0k9BLL6AydveTuakEjRTy3xzkb1
=+FsG
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message