Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-27954

Scan fail for "Too many open files"

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: clamav-plugin
    • Labels:
      None
    • Environment:
      Jenkins ver. 1.596.1
      ClamAV Plugin 0.2.1
      apache-tomcat-6.0.39
      java version jdk1.7.0_55
    • Similar Issues:

      Description

      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)

      { throw new IllegalArgumentException("file is null."); }

      String response;
      try

      { response = instream(file); }

      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);
      }

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Seiji Sogabe
          Path:
          src/main/java/org/jenkinsci/plugins/clamav/ClamAvRecorder.java
          http://jenkins-ci.org/commit/clamav-plugin/1cc0fa61061452f1ab5a98f04dc8221d083ec0af
          Log:
          [FIXED JENKINS-27954] ensure file is closed.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Seiji Sogabe Path: src/main/java/org/jenkinsci/plugins/clamav/ClamAvRecorder.java http://jenkins-ci.org/commit/clamav-plugin/1cc0fa61061452f1ab5a98f04dc8221d083ec0af Log: [FIXED JENKINS-27954] ensure file is closed.
          Hide
          faxfax fabio farronato added a comment -

          Thanks.

          Show
          faxfax fabio farronato added a comment - Thanks.

            People

            • Assignee:
              sogabe sogabe
              Reporter:
              faxfax fabio farronato
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: