GeezerVison is showing github.com — ObjectCleanerThread not be closed · Issue #7617 · netty/netty
ObjectCleanerThread not be closed #7617DescriptionNetty version
4.1.20.Final
JVM version (e.g. java -version)
9.0.1
OS version (e.g. uname -a)
Windows 10
Non-finished threads:
Thread[DestroyJavaVM,5,main]
Thread[ObjectCleanerThread,1,main]
at [email protected]/java.lang.Object.wait(Native Method)
at [email protected]/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
at app//io.netty.util.internal.ObjectCleaner$1.run(ObjectCleaner.java:52)
at app//io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at [email protected]/java.lang.Thread.run(Thread.java:844) Activitynormanmaurer commented on Jan 24, 2018 johnou commented on Jan 24, 2018 @normanmaurer why isn't there a break in the loop if the thread is interrupted? wouldn't that indicate the application is shutting down? normanmaurer commented on Jan 24, 2018 @johnou I think it should still cary on cleanup until there are no more references as otherwise we may leak direct memory etc. It should only exit once the LIVE_SET is empty imho. johnou commented on Jan 24, 2018 @normanmaurer then how about a daemon thread? Allowing the JVM process to terminate in a timely manner. normanmaurer commented on Jan 24, 2018 @johnou we decided against a daemon thread to make harder guarantees about cleanup. If it would be a deamon thread we may leak direct memory for example when someone hot-deploy stuff.
Also /cc @Scottmitch , as both of us had the discussion :) Scottmitch commented on Jan 25, 2018 Yes we considered daemon but decided against it. Although I would expect most OSes we run on will clean up process resources after the process dies we can’t be sure of this. Since we allocate native resources outside the scope of the JVM the more conservative approach is to go non daemon. The mitigation factor was to have a timeout on the poll. This may cause issues if some of the jvm shutdown processing contains references to items registered in the cleaner but this seemed unlikely when the discussion took place. hank-whu commented on Jan 25, 2018 @normanmaurer
shoud i wait 10 seconds after shutdown the EventLoopGroup ?
it doesn't seem like a good way.
can add a "shutdown(long mills)" method to ObjectCleanerThread ? normanmaurer commented on Jan 25, 2018 johnou commented on Jan 25, 2018 @normanmaurer it can actually stop the jvm from terminating, I'll post more details shortly. normanmaurer commented on Jan 25, 2018 Thx...
…
Am 25.01.2018 um 09:27 schrieb Johno Crawford ***@***.***>:
@normanmaurer it can actually stop the jvm from terminating, I'll post more details shortly.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
hank-whu commented on Jan 25, 2018 Ensure all threads are closed, "wait some time" is the only way.
I think this is not very good.
I need a method to ensure all threads are closed. johnou commented on Jan 25, 2018 @normanmaurer I would expect something like this to exit gracefully without an explicit System.exit call.
public class Main {
public static void main(String[] args) {
ByteBuf byteBuf = PooledByteBufAllocator.DEFAULT.buffer();
byteBuf.release();
System.gc();
System.runFinalization();
// hangs because ObjectCleanerThread is not a daemon thread / LIVE_SET is not empty..
}
}Reacted by Jay Modi and Laraka | Lara Bärtschi normanmaurer commented on Jan 25, 2018 Reacted by Johno Crawford normanmaurer commented on Jan 25, 2018 slandelle commented on Jan 31, 2018 mcfongtw commented on May 7, 2018 Hi, is this fix included in any 4.1.x release yet? fenik17 commented on May 7, 2018 mcfongtw commented on May 7, 2018
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|