-
Bug
-
Resolution: Fixed
-
Minor
-
None
Issue:
Script approval is failing for groovy postbuild plugin, for classpath entries, when underlying jar file content is modified, when jar file is hosted on NFS mount.
In think that the problem comes from the jar file which isn't correctly closed. On the linux FS we know that it's not a problem to delete a file which is used by a process but on NFS (or on Windows FS) you are doomed.
File descriptors show:
cat file-descriptors.txt | grep my.jar /nfs_mounted_path_to_classpath_entry/my.jar (deleted) /nfs_mounted_path_to_classpath_entry/my.jar (deleted) /nfs_mounted_path_to_classpath_entry/my.jar /nfs_mounted_path_to_classpath_entry/my.jar (deleted)
Versions:
- Jenkins 1.642.18
- https://wiki.jenkins-ci.org/display/JENKINS/Script+Security+Plugin 1.22
- https://wiki.jenkins-ci.org/display/JENKINS/Groovy+Postbuild+Plugin 2.3.1
Suggested fix (jglick can you review?):
Make SecureGroovyScript.evaluate call URLClassLoader.close (Java 7)
Error:
2016-10-14 14:45:52.324-0400 [id=79] WARNING o.j.p.s.scripts.ScriptApproval#configuring: nulljava.io.FileNotFoundException: /nfs_mounted_path_to_classpath_entry/my.jar (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.hashClasspathEntry(ScriptApproval.java:379)
at org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.configuring(ScriptApproval.java:491)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.configuring(SecureGroovyScript.java:109)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.readResolve(SecureGroovyScript.java:82)
at sun.reflect.GeneratedMethodAccessor84.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callReadResolve(SerializationMethodInvoker.java:66)
at hudson.util.RobustReflectionConverter.unmarshal(RobustReflectionConverter.java:230)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at hudson.util.RobustReflectionConverter.unmarshalField(RobustReflectionConverter.java:352)
at hudson.util.RobustReflectionConverter.doUnmarshal(RobustReflectionConverter.java:290)
at hudson.util.RobustReflectionConverter.unmarshal(RobustReflectionConverter.java:229)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)
at hudson.util.CopyOnWriteList$ConverterImpl.unmarshal(CopyOnWriteList.java:197)
at hudson.util.DescribableList$ConverterImpl.unmarshal(DescribableList.java:273)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at hudson.util.RobustReflectionConverter.unmarshalField(RobustReflectionConverter.java:352)
at hudson.util.RobustReflectionConverter.doUnmarshal(RobustReflectionConverter.java:290)
at hudson.util.RobustReflectionConverter.unmarshal(RobustReflectionConverter.java:229)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1189)
at hudson.util.XStream2.unmarshal(XStream2.java:114)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1173)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1053)
at hudson.XmlFile.read(XmlFile.java:142)
at hudson.model.Items.load(Items.java:326)
at hudson.model.ItemGroupMixIn.loadChildren(ItemGroupMixIn.java:116)
at com.cloudbees.hudson.plugins.folder.AbstractFolder.onLoad(AbstractFolder.java:283)
at com.cloudbees.hudson.plugins.folder.Folder.onLoad(Folder.java:104)
at hudson.model.Items.load(Items.java:327)
at hudson.model.ItemGroupMixIn.loadChildren(ItemGroupMixIn.java:116)
at com.cloudbees.hudson.plugins.folder.AbstractFolder.onLoad(AbstractFolder.java:283)
at com.cloudbees.hudson.plugins.folder.Folder.onLoad(Folder.java:104)
at hudson.model.Items.load(Items.java:327)
at jenkins.model.Jenkins$18.run(Jenkins.java:2719)
at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
at jenkins.model.Jenkins$8.runTask(Jenkins.java:925)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
- links to