Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
9.0
-
Java: 10.0.2; OpenJDK 64-Bit Server VM 10.0.2+13, Runtime: OpenJDK Runtime Environment 10.0.2+13, System: Windows 10 version 10.0 running on amd64; Cp1252; en_US
Description
I have just updated my NetBeans Platform application to use NetBeans 9.0-vc3. There seems to be a new problem with NetBeans' JarClassLoader, whereby an exception dialog pops up if a thread happens to be interrupted while the classloader is loading a new class. The stack trace is as follows:
WARNING [org.netbeans.JarClassLoader]: looking up com/ultorg/box/builders/EmptyBoxBuilder.class java.nio.channels.ClosedByInterruptException at java.base/java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:199) at java.base/sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:228) at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65) at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:109) at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:103) at org.netbeans.JarClassLoader$DirSource.readClass(JarClassLoader.java:889) [catch] at org.netbeans.JarClassLoader$Source.getClassData(JarClassLoader.java:371) at org.netbeans.JarClassLoader.doLoadClass(JarClassLoader.java:213) at org.netbeans.ProxyClassLoader.selfLoadClass(ProxyClassLoader.java:234) at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:162) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499) at com.ultorg.layout.internal.LayoutContext.emptyBoxBuilder(LayoutContext.java:393) (...more calls in application code that's designed to be interruptible...) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418) at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
The application in question is multi-threaded, with a RequestProcessor task running a visualization routine that can be interrupted and restarted in response to a number of common UI events. In this case the visualization routine is being started but immediately interrupted a few milliseconds later, before the classloader has had time to finish its work.
I suspect the problem was introduced when JarClassLoader was migrated to use the new NIO-based InputStream implementations; see https://github.com/apache/incubator-netbeans/commit/4b82e6adb31e294c74fd2fa99779ce9e27ae6184 . These streams support interruption, while the regular old FileInputStream would just have its read() calls block and run to completion even when the calling thread was interrupted. In JarClassLoader's case, it probably makes sense to keep the old behavior: always finish loading the class even when the current thread is interrupted.
Attachments
Issue Links
- duplicates
-
NETBEANS-1658 Switch to NIO based file access causes regression
- Closed
- links to