-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Classloader memory leak via JNI global references #13480
Copy link
Copy link
Closed
Milestone
Description
Expected behavior
Netty (in this case via reactor-netty) can be used in conjunction with multiple classloaders, allowing classloaders to be properly unloaded if not referenced anymore. (in this case this is important for a gradle plugin)
Actual behavior
When using netty-resolver-dns-native-macos, a classloader and all its classes can not be unloaded even if not referenced anymore as the class io.netty.resolver.dns.macos.DnsResolver is a GC root as a JNI global reference.
This class (and other required classes) are loaded via NETTY_JNI_UTIL_LOAD_CLASS (
| NETTY_JNI_UTIL_LOAD_CLASS(env, dnsResolverClass, nettyClassName, done); |
NewGlobalRef (https://github.com/netty/netty-jni-util/blob/8d820fba781882f8a7fe94efb7656d1413ff8bb8/src/main/c/netty_jni_util.h#L45).
Maybe using weak global references instead of global references of the classes is a solution.
Or is there any other solutions how to safely use netty with dynamic classloaders?
Netty version
4.1.94.Final via reactor-netty:1.1.8
JVM version (e.g. java -version)
Any
OS version (e.g. uname -a)
MacOS
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels