[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Integrated: 8273831: PrintServiceLookup spawns 2 threads in the current classloader, getting orphane
From:       Sergey Bylokhov <serb () openjdk ! java ! net>
Date:       2021-10-30 9:08:20
Message-ID: WpG2oYXNvItWkJ2wN3N4hJKwLyrf5hDF6fJl4c5RLLE=.8e112091-9184-4d52-a0a0-3a7e398a1cda () github ! com
[Download RAW message or body]

On Thu, 14 Oct 2021 05:43:53 GMT, Sergey Bylokhov <serb@openjdk.org> wrote:

> The PrintServiceLookupProvider can spawn 2 threads on WIndows and one thread on \
> Linux. These threads are connected to the classloader of the web application.  \
> During undeployment the app classloader gets removed together with the two orphaned \
> threads by the Tomcat.  
> Looks like the tomcat has special machinery to workaround such threads:
> https://cwiki.apache.org/confluence/display/tomcat/MemoryLeakProtection#MemoryLeakProtection-cclThreadSpawnedByJRE
>  But it should be updated each time we add/update/rename the threads in the JDK. So \
> JreMemoryLeakPreventionListener can be updated to solve this problem, but it will \
> be good to reset the ref to the app class loader as we usually do for our internal \
> threads.  
> The change updates threads to use the root thread group and null context class \
> loader. 
> A similar pattern is used here:
> https://github.com/openjdk/jdk/blob/6765f902505fbdd02f25b599f942437cd805cad1/src/java.desktop/share/classes/com/sun/imageio/stream/StreamCloser.java#L89
>  
> @aivanov-jdk please take a look

This pull request has now been integrated.

Changeset: 68756782
Author:    Sergey Bylokhov <serb@openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/687567822a5380fb7d8c5b54ae548b2a5c848187
                
Stats:     120 lines in 3 files changed: 104 ins; 3 del; 13 mod

8273831: PrintServiceLookup spawns 2 threads in the current classloader, getting \
orphaned

Reviewed-by: aivanov

-------------

PR: https://git.openjdk.java.net/jdk/pull/5939


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic