Bug 62897 - Provide a property to disable WebappClassLoaderBase.checkThreadLocalsForLeaks()
Summary: Provide a property to disable WebappClassLoaderBase.checkThreadLocalsForLeaks()
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 9.0.x
Hardware: All All
: P2 normal (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
: 62901 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-11-09 09:39 UTC by Andy Wilkinson
Modified: 2018-11-10 20:29 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Wilkinson 2018-11-09 09:39:51 UTC
When running on Java 11 with clearReferencesObjectStreamClassCaches and clearReferencesRmiTargets both set to false, a number of reflective access warnings are still generated when the web app class loader is stopped:

WARNING: Illegal reflective access by org.apache.catalina.loader.WebappClassLoaderBase (file:/Users/awilkinson/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.12/tomcat-embed-core-9.0.12.jar) to field java.lang.Thread.threadLocals
WARNING: Illegal reflective access by org.apache.catalina.loader.WebappClassLoaderBase (file:/Users/awilkinson/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.12/tomcat-embed-core-9.0.12.jar) to field java.lang.Thread.inheritableThreadLocals
WARNING: Illegal reflective access by org.apache.catalina.loader.WebappClassLoaderBase (file:/Users/awilkinson/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.12/tomcat-embed-core-9.0.12.jar) to field java.lang.ThreadLocal$ThreadLocalMap.table
WARNING: Illegal reflective access by org.apache.catalina.loader.WebappClassLoaderBase (file:/Users/awilkinson/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.12/tomcat-embed-core-9.0.12.jar) to method java.lang.ThreadLocal$ThreadLocalMap.expungeStaleEntries()
WARNING: Illegal reflective access by org.apache.catalina.loader.WebappClassLoaderBase (file:/Users/awilkinson/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.12/tomcat-embed-core-9.0.12.jar) to field java.lang.ThreadLocal$ThreadLocalMap$Entry.value

I believe these all originate from code that's called by WebappClassLoaderBase.checkThreadLocalsForLeaks(). It would be useful to have a property that allows these checks to be disabled in the same way as the others.
Comment 1 Mark Thomas 2018-11-09 12:08:29 UTC
Fixed in:
- trunk for 9.0.14 onwards
- 8.5.x for 8.5.36 onwards
- 7.0.x for 7.0.93 onwards
Comment 2 Mark Thomas 2018-11-10 20:29:45 UTC
*** Bug 62901 has been marked as a duplicate of this bug. ***