You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PluginLoader creates some URLClassLoader and never closes them. When the URLClassLoader points to a .jar file, the JVM process keeps a reference to that file (a RandomAccessFile instance) preventing from deleting/renaming that .jar file.
This is an issue when the JVM process is long lived, for instance when it's running inside the Gradle daemon (see spotbugs/sonar-findbugs#128)
The RandomAccessFile is created as soon as the classloader opens the .jar file, which for me was when looking for the non-existing resource messages_en_GB.xml. The URL does not exist because the .jar does not contain it so calling JarURLConnection.setUseCaches() wouldn't help here.
To sum up, this code reproduces the issue: omitting the close() on the last line creates a lock on the plugin jar file until the JVM process is stopped.
URLClassLoader classLoader = new URLClassLoader(new URL[] {workingPluginFile.toURI().toURL()});
classLoader.findResource("messages_en_GB.xml");
classLoader.close();
The text was updated successfully, but these errors were encountered:
PluginLoader creates some URLClassLoader and never closes them. When the URLClassLoader points to a .jar file, the JVM process keeps a reference to that file (a RandomAccessFile instance) preventing from deleting/renaming that .jar file.
This is an issue when the JVM process is long lived, for instance when it's running inside the Gradle daemon (see spotbugs/sonar-findbugs#128)
The RandomAccessFile is created as soon as the classloader opens the .jar file, which for me was when looking for the non-existing resource
messages_en_GB.xml
. The URL does not exist because the .jar does not contain it so callingJarURLConnection.setUseCaches()
wouldn't help here.To sum up, this code reproduces the issue: omitting the
close()
on the last line creates a lock on the plugin jar file until the JVM process is stopped.The text was updated successfully, but these errors were encountered: