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

All,

On 3/21/18 12:27 PM, Christopher Schultz wrote:
> Okay, I already had closeMethod="close" set. I just need to set up
> a test-case where I can check to see if it's actually doing it.
> Perhaps I can just throw-out my ServletContextListener.
> 
> I should be able to:
> 
> 0. Disable my Listener 1. Launch Tomcat + my webapp 2.
> Stop/undeploy my webapp

Got this on stdout:

Mar 21, 2018 3:04:00 PM
org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
WARNING: The web application [webapp] appears to have started a thread
named [Abandoned connection cleanup thread] but has failed to stop it.
This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
 com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnection
CleanupThread.java:43)

Thanks again, Connector/J. :( This is library version 5.1.38. I'll try
a later version, but I'm not hopeful.

I have no SQL-related timeouts configured and the Connector/J library
is documented "not to start any Threads unless you use
query-timeouts". Evidently not :(

[time passes]

UPDATE: MySQL Connector/J 5.1.44 appears to use the proper TCCL so
although the "Abandoned connection cleanup thread" continues to run,
it doesn't pin my ClassLoader in memory anymore.

The TCCL appears to be Tomcat's "Common" ClassLoader[1] -- the one
that contains everything under CATALINA_HOME/lib/*.jar. I'll have to
check the code, but I suspect Connector/J is finally using their own
.class's ClassLoader as the TCCL of that thread instead of whatever
ClassLoader triggers the creation of the thread (e.g. The
WebappClassLoader).

The real problem is that they don't yet provide a mechanism to
shut-down that thread from client code.

We'll see if that becomes a problem when I move the JAR file into
WEB-INF/lib. I might be back to pinning the WebappClassLoader.

> 3. Check via JMX to see if the DataSource has shut down

There is no DataSource tree in JMX after calling stop() on the
context, so I think that's satisfactory in terms of behavior. :)

> If that works, I can just remove my listener.

Looks like I can abandon my listener as we move to Tomcat 8.5. (We may
be able to do it in Tomcat 8.0 as well; I'll confirm that, too.)

Thanks,
- -chris

[1] https://tomcat.apache.org/tomcat-8.5-doc/class-loader-howto.html
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlqyxVMdHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFgVbQ/8CB9FWD0aYk/iaYOW
slofQiUeb7ElxQ6mhHUv3Y1+xWCX0D3rAAhlKsgCeii1r06qjZ7hZvlBQGCYRAae
q7l/ex4Ysc9S19BVkjBzuwALRiZGcEuKzrgb2x2Z+AsCLuIRM8DcfcYe26mpbWea
BF7vD6l5A9xgGv8UBxdCKOpo+r2E4LOrxCuSvcOtPb1AQz9msT3gp41qZUhrRupd
Qu8ucNWqmWwwmkjlQ7Ss1cXdivPfTXSiuCXE7Li+RvnCbbG8WMU7kuOam+OdIk2y
RW3ru05E5mkKJPEjQ82MjZrIABwXalovMgjyRtUXw6eBaVDK9YfOwwAW6egfIc2a
Bnqv9QIE0qu6ROkSCUF0J0zOy4a7c+U2uIqZRZldkjvC+7Ho58/uSHpOuq58/E7z
MpGHW8+NTyBSw/tyQH4NtPYURoq9P7/0ofvt0cLvSvB1GcSazaLEegR7P+GtXA+h
cAf+E05NB4Y044BJO0CQQRdEzUQ2jLo1BihUCvJYXbdyf4sl7eY2EDAN/QYSDxqx
+E3XpSt0ZxFs9oy5tX82mzUb0Bi9rnJ6cndSge8FpLf/T+dZZfY0u8u8a4Om3YpX
RPeghOQVXsUiR0X0GddYLKdBIY8xWR6YBhZxSdAQE7QxDY/fcA44eetI2Ou4Zs4N
t3GynQLasj3q8EHJTI8FILIHV5w=
=0h0y
-----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