Filing a bug for an already fixed issue, to summarize discussions spawned across different mailing lists, and for better changelog. See "Tomcat 8, 8.5 and 9 returning another apps environment with context.lookup() from a .parallelStream()", 2017-01-08 on users@ http://markmail.org/message/qcy6rqhw52sspyv7 See "Memory leak found in java.util.concurrent.ForkJoinPool", 2017-01-09 on dev@ http://markmail.org/message/7w5wspqeayx7dr5x
A workaround for this Oracle JRE bug was added to memory leaks protection code in Tomcat 7.0.74 (r1778068), 8.5.11 (r1778065), 9.0.0.M17 (r1778061) The fix has not been applied to Tomcat 8.0 yet. Note that compilation of SafeForkJoinWorkerThreadFactory requires Java 7 and later. People who use two separate Eclipse projects for Tomcat 7 (separating code that requires java 6 and java 7 into different projects) need to update their include / exclude patterns. The sample projects were updated in r1779707, to be in 7.0.76.
Moving the issue to Tomcat 8.0, as the fix has not been applied there yet. As a variant, we can add the helper class but keep the protection feature off by default. This may wait a while, to get more feedback.
Fixed in r1780268 for 8.0.42 onwards.