-
Bug
-
Resolution: Fixed
-
Major
-
None
-
Jenkins ver. 1.596.1
ClamAV Plugin 0.2.1
apache-tomcat-6.0.39
java version jdk1.7.0_55
During scan of workspace, with a large number of files, ClamAvRecorder abort scan whith Error:
ERROR: Publisher org.jenkinsci.plugins.clamav.ClamAvRecorder aborted due to exception
java.io.FileNotFoundException: /home/sonar/.jenkins/jobs/PJ-PORT_PCPLS/workspace/proj/target/test-classes/generated/RESPONSE$DATA$CPLCOMANDOPL.class (Too many open files)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at hudson.FilePath.read(FilePath.java:1739)
at org.jenkinsci.plugins.clamav.ClamAvRecorder.perform(ClamAvRecorder.java:117)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
at hudson.model.Run.execute(Run.java:1784)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
I analyzed the source code and suggest you to manage the file's close() at
ClamAvScanner.java:97 with insert a finally block.
public ScanResult scan(InputStream file) {
if (file == null)
String response;
try
catch (IOException e)
{ return new ScanResult(Status.WARNING, e.getMessage()); }finally
{ ... file.close(); ... }if (response.contains("FOUND\0"))
{ String sig = response.substring("stream: ".length(), response.lastIndexOf("FOUND") - 1); return new ScanResult(Status.INFECTED, sig); } return new ScanResult(Status.PASSED);
}