-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

All,

My primary webapp (and ClassLoader) used to unload cleanly but now I
get WebappClassLoaders still stuck in memory after a reload. I'm
having a little trouble figuring out exactly what is holding onto
references. Here's what I know:

- - Tomcat 7.0.40
- - Running Sun/Oracle Java 1.6.0_26 64-bit Server JVM
- - Running on Linux 2.6.32 kernel
- - Using MySQL Connector/J 5.1.24 (important later)
- - Not running under a SecurityManager
- - JreMemoryLeakPreventionListener is enabled
- - <Context> has no "clearReferences...*" attributes set (all default
to "false" save for HttpClientKeepAlive)

I took a heap dump, and I can see that I have a WebappClassLoader
pinned in memory, "started=false", etc.

When looking at the GC roots, I can see the following references to
the WebappClassLoader:

WebappClassLoader
^- classloader of java.security.ProtectionDomain
   ^- [7] of java.security.ProtectionDomain[8]
      ^- context of java.security.AccessControlContext
         ^- inheritedAccessControlContext of
com.mysql.jdbc.AbandonedConnectionCleanupThread

There are a few other roots, but they are either (almost) identical to
the above or similar enough to the above that I figure they are pretty
much the same: this Connector/J thread has an indirect reference to my
WebappClassLoader for some reason.

Here's what I know about that thread:

- - It's class's ClassLoader is an o.a.c.loader.StandardClassLoader (yay!)
- - The Thread's Class's ProtectionDomain's ClasSLoader is
StandardClassLoader (yay!)
- - I'm not sure what that Thread's current context class loader is (any
idea how to find out? Browsing the object's members isn't leading me
anywhere)
- - The thread is running.

AbandonedConnectionCleanupThread has a member called
inheritedAccessControlContext which is a wrapper around
ProtectionDomain[]. Some elements in that array have a ClassLoader of
my WebappClassLoader, while others have StandardClassLoader and still
others have the JVM's application ClassLoader (the one once-removed
from boot, Chuck ;).

So, it looks like the ProtectionDomain objects themselves are what are
trapping me, here.

I'm not an expert at the internals of Java's security infrastructure,
nor have I dived into the Connector/J code (yet). I was wondering if
anyone had any guidance for me before I proceed.

(There is an updated 5.1.25 Connector/J driver that has a note in the
ChangeLog about ClassLoader references specifically-related to Tomcat.
I'll try with the latest -- which is likely to have a regression in it
because of the stupid fix to http://bugs.mysql.com/bug.php?id=68556 --
and see what the differences are).

At any rate, I'm curious as to where the ProtectionDomain objects are
actually created.

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

iQIcBAEBCAAGBQJRqMRMAAoJEBzwKT+lPKRYPpcQAIxX984igfcVyfHxuwE11Dd1
XRXfMCyGX9RAQLgXWtbjV8iROpUat2AsBrYeJeZ/4UnohnJAbkaVe66NronSDX0P
ZVRcFPViz/PjXwRQOV81Jo+2clGv3jpgLwszF+QxQpLjixRYmgLSHXk/u+zgOeqH
m2KE3t/mrpuSAbboVjucepdd7Lc1MtY59wl9NVu2WgAWzTAnJ6LyUKTPGJToD5+/
H7/THkmXcoxitqYPvwLiTlZtzds7eoooc+WZpMqMDZ6Cspi12M/gkefb1MTu3Ufu
9EsLa6ZvrY2taySYS8yFQUfmM11BJzoiK9GlHRAHa/x/9zhztE+chzvpyLgdCMxg
6A4jY4RZHkXr9z8T/tvmSoT8lIE1/RY+M1l86sjQMBSUGlJZJi/WhjM2G0EV5MEr
DArBpV8fiovb6cV+aqQQ1rce3tfar1amUt9LzGfBethqzpZ64zqsTqEpXCTxxqXV
7kNZSmB009ziP6xat9kzqPmwcTV97YQFxDDLOAs7O6Z9Lj1OXBkCA/Jy1NRMJWmn
UiDbER2zc3SS2+QpRuzJt+z0LADP4/wlM3qJDbyLSWJP3QkQlDILjKB5xGXs3Z3Q
Y70qzwsBVV6svB9zyqE5AMfMP+K60CwX2qWm4NiBTskIwcmJ1TTNvrsjFoI2Dzri
dKYpPlsk3eMufOS5s16Q
=s4fy
-----END PGP SIGNATURE-----

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

Reply via email to