Eirik Bakke created NETBEANS-1197:
-------------------------------------

             Summary: ClosedByInterruptException in NetBeans classloader
                 Key: NETBEANS-1197
                 URL: https://issues.apache.org/jira/browse/NETBEANS-1197
             Project: NetBeans
          Issue Type: Bug
          Components: platform - Module System
    Affects Versions: 9.0
         Environment: 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

            Reporter: Eirik Bakke


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:
{noformat}
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)
{noformat}
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.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to