Since #413 (method postFindClass is synchronized) the FXClassLoader causes a deadlock when run on multiple threads. Example:
"JavaFX Application Thread" #1 prio=5 os_prio=0 cpu=15812.50ms elapsed=68.07s tid=0x0000000002b0a000 nid=0x1010 waiting for monitor entry [0x0000000000578000]
java.lang.Thread.State: BLOCKED (on object monitor)
at java.lang.ClassLoader.loadClass(java.base@11.0.8/ClassLoader.java:568)
- waiting to lock <0x00000000f0b2b6f8> (a org.eclipse.fx.osgi.fxloader.FXClassLoader$1)
at java.lang.ClassLoader.loadClass(java.base@11.0.8/ClassLoader.java:521)
at org.eclipse.fx.osgi.fxloader.FXClassLoader.findClassJavaFX11(FXClassLoader.java:246)
at org.eclipse.fx.osgi.fxloader.FXClassLoader.postFindClass(FXClassLoader.java:144)
- locked <0x00000000f09556a0> (a org.eclipse.fx.osgi.fxloader.FXClassLoader)
at org.eclipse.osgi.internal.loader.BundleLoader.searchHooks(BundleLoader.java:532)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:494)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:171)
at java.lang.ClassLoader.loadClass(java.base@11.0.8/ClassLoader.java:521)
at java.lang.Class.getDeclaredConstructors0(java.base@11.0.8/Native Method)
at java.lang.Class.privateGetDeclaredConstructors(java.base@11.0.8/Class.java:3137)
at java.lang.Class.getConstructor0(java.base@11.0.8/Class.java:3342)
at java.lang.Class.getDeclaredConstructor(java.base@11.0.8/Class.java:2553)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:204)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:920)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:246)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:63)
...
"QuantumRenderer-0" #72 daemon prio=5 os_prio=0 cpu=156.25ms elapsed=17.45s tid=0x00000000234f0000 nid=0x1d40 waiting for monitor entry [0x000000002f7ad000]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.eclipse.fx.osgi.fxloader.FXClassLoader.postFindClass(FXClassLoader.java:110)
- waiting to lock <0x00000000f09556a0> (a org.eclipse.fx.osgi.fxloader.FXClassLoader)
at org.eclipse.osgi.internal.loader.BundleLoader.searchHooks(BundleLoader.java:532)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:494)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:171)
at java.lang.ClassLoader.loadClass(java.base@11.0.8/ClassLoader.java:575)
- locked <0x00000000f0b2b6f8> (a org.eclipse.fx.osgi.fxloader.FXClassLoader$1)
at java.lang.ClassLoader.loadClass(java.base@11.0.8/ClassLoader.java:521)
at com.sun.scenario.effect.impl.prism.PrEffectHelper.render(javafx.graphics/PrEffectHelper.java:163)
at com.sun.javafx.sg.prism.EffectFilter.render(javafx.graphics/EffectFilter.java:61)
at com.sun.javafx.sg.prism.NGNode.renderEffect(javafx.graphics/NGNode.java:2384)
at com.sun.javafx.sg.prism.NGNode.doRender(javafx.graphics/NGNode.java:2069)
at com.sun.javafx.sg.prism.NGNode.render(javafx.graphics/NGNode.java:1964)
at com.sun.javafx.tk.quantum.ViewPainter.doPaint(javafx.graphics/ViewPainter.java:479)
at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(javafx.graphics/ViewPainter.java:328)
at com.sun.javafx.tk.quantum.UploadingPainter.run(javafx.graphics/UploadingPainter.java:142)
at java.util.concurrent.Executors$RunnableAdapter.call(java.base@11.0.8/Executors.java:515)
at java.util.concurrent.FutureTask.runAndReset(java.base@11.0.8/FutureTask.java:305)
at com.sun.javafx.tk.RenderJob.run(javafx.graphics/RenderJob.java:58)
at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.8/ThreadPoolExecutor.java:1128)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.8/ThreadPoolExecutor.java:628)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(javafx.graphics/QuantumRenderer.java:125)
at java.lang.Thread.run(java.base@11.0.8/Thread.java:834)
we are only storying a boolean value - so I don't think we are leaking that much memory but you are right we should use remove() instead of setValue(false) - file an issue and provide a patch
Since #413 (method
postFindClass
is synchronized) the FXClassLoader causes a deadlock when run on multiple threads. Example: