- 
    Bug 
- 
    Resolution: Fixed
- 
     P4 P4
- 
    9
- 
    None
                    From: Stanimir Simeonoff: 
<<
On leaks. The c-tor of LogManager leaks the thread group and the current AccessControlContext till JVM shutdown. The constructor code should be something like the one below with Cleaner getting ThreadGroup in its c-tor as well.
java.security.AccessController.doPrivileged(//zip thread.inheritedAccessControlContext
new java.security.PrivilegedAction<Void>() {
public Void run() {
// put the cleaner in the systsm threadgroup
ThreadGroup grp = Thread.currentThread().getThreadGroup();
for(ThreadGroup parent;null!=(parent = grp.getParent());) {
grp = parent;
}
Cleaner cleaner = new Thread(grp);
cleaner.setContextClassLoader(null);//zip the classloader
           
// Add a shutdown hook to close the global handlers.
try {
Runtime.getRuntime().addShutdownHook(cleaner);
} catch (IllegalStateException e) {
// If the VM is already shutting down,
// We do not need to register shutdownHook.
}
return null;
}
});
>>
see http://mail.openjdk.java.net/pipermail/core-libs-dev/2014-September/028667.html
            
<<
On leaks. The c-tor of LogManager leaks the thread group and the current AccessControlContext till JVM shutdown. The constructor code should be something like the one below with Cleaner getting ThreadGroup in its c-tor as well.
java.security.AccessController.doPrivileged(//zip thread.inheritedAccessControlContext
new java.security.PrivilegedAction<Void>() {
public Void run() {
// put the cleaner in the systsm threadgroup
ThreadGroup grp = Thread.currentThread().getThreadGroup();
for(ThreadGroup parent;null!=(parent = grp.getParent());) {
grp = parent;
}
Cleaner cleaner = new Thread(grp);
cleaner.setContextClassLoader(null);//zip the classloader
// Add a shutdown hook to close the global handlers.
try {
Runtime.getRuntime().addShutdownHook(cleaner);
} catch (IllegalStateException e) {
// If the VM is already shutting down,
// We do not need to register shutdownHook.
}
return null;
}
});
>>
see http://mail.openjdk.java.net/pipermail/core-libs-dev/2014-September/028667.html
- duplicates
- 
                    JDK-8153158 Remove sun.misc.ManagedLocalsThread from java.logging -           
- Resolved
 
-