SonarQube Plugins
  1. SonarQube Plugins
  2. SONARPLUGINS-1439

Running sonar for multiple projects at the same time gives Exception "Caused by: java.io.IOException: No space left on device""

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: ANT-TASK-2.0
    • Component/s: Ant Task
    • Labels:
      None
    • Environment:
      Linux
    • Number of attachments :
      0

      Description

      1. Sonar succeeds for one project at a time runs.
      2. I have a big source code base divided into sub projects and hence configured an ant task to run sonar analysis for every sub project through a build server.
      3. The memory on /tmp folder keeps going high and eventually runs out of space, causing the build to fail.

      Additional Notes: Following is the state of temp directory when it is about to crash due to "Out of space error"

      [machine tmp]$ /usr/sbin/lsof |grep /tmp/sonar|wc -l
      2016
      [machine tmp]$ find sonar-batch284149543705107600625648239897612202/ |wc -l
      74

      This indicates that probably a "file.delete" is being called on the temporary files and hence they are not visible in /tmp directory. But a "file.close" has not yet been called on the stream and hence the file descriptor is still open with the OS.

        Issue Links

          Activity

          Hide
          Sandeep Singhal added a comment - - edited
          • by "memory on /tmp" I mean disk space.
          • I am using the ANT plugin for sonar runs
          Show
          Sandeep Singhal added a comment - - edited by "memory on /tmp" I mean disk space. I am using the ANT plugin for sonar runs
          Hide
          Sandeep Singhal added a comment - - edited

          Problem is most likely in the file : title:org.sonar.batch.bootstrap.TempDirectories
          It is doing a deleteQuitely which is deleting the files, but not closing the file descriptors.

            public void stop() {
              directoriesByKey.clear();
          
              LoggerFactory.getLogger(getClass()).debug("Delete temporary directories");
          
              // Deleting temp directory does not work on MS Windows and Sun JVM because URLClassLoader locks JARs and resources.
              // The workaround is that sonar deletes orphans itself.
          
              // older than AGE_BEFORE_DELETION to be sure that the current dir is deleted on mac and linux.
              rootDir.setLastModified(System.currentTimeMillis() - AGE_BEFORE_DELETION - 60 * 60 * 1000);
          
              File[] directoriesToDelete = rootDir.getParentFile().listFiles((FileFilter) new AndFileFilter(Arrays.asList(
                  DirectoryFileFilter.DIRECTORY, new PrefixFileFilter(DIR_PREFIX), new AgeFileFilter(System.currentTimeMillis() - AGE_BEFORE_DELETION))));
              for (File dir : directoriesToDelete) {
                LoggerFactory.getLogger(getClass()).debug("Delete temporary directory: " + dir);
                FileUtils.deleteQuietly(dir);
              }
            }
          }
          
          Show
          Sandeep Singhal added a comment - - edited Problem is most likely in the file : title:org.sonar.batch.bootstrap.TempDirectories It is doing a deleteQuitely which is deleting the files, but not closing the file descriptors. public void stop() { directoriesByKey.clear(); LoggerFactory.getLogger(getClass()).debug( "Delete temporary directories" ); // Deleting temp directory does not work on MS Windows and Sun JVM because URLClassLoader locks JARs and resources. // The workaround is that sonar deletes orphans itself. // older than AGE_BEFORE_DELETION to be sure that the current dir is deleted on mac and linux. rootDir.setLastModified( System .currentTimeMillis() - AGE_BEFORE_DELETION - 60 * 60 * 1000); File[] directoriesToDelete = rootDir.getParentFile().listFiles((FileFilter) new AndFileFilter(Arrays.asList( DirectoryFileFilter.DIRECTORY, new PrefixFileFilter(DIR_PREFIX), new AgeFileFilter( System .currentTimeMillis() - AGE_BEFORE_DELETION)))); for (File dir : directoriesToDelete) { LoggerFactory.getLogger(getClass()).debug( "Delete temporary directory: " + dir); FileUtils.deleteQuietly(dir); } } }
          Hide
          Freddy Mallet added a comment -

          With the ability to define the location of the Sonar working directory (for instance in the bin/sonar directory) this should not be anymore an issue.

          Show
          Freddy Mallet added a comment - With the ability to define the location of the Sonar working directory (for instance in the bin/sonar directory) this should not be anymore an issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              Sandeep Singhal
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: