Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-3492

File.deleteOnExit not enough for embedder&CI

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Incomplete
    • 2.0.7
    • None
    • None

    Description

      When Maven is used in another long-running process (in this case Hudson), File.deleteOnExit() is not run early enough, so we end up accumulating insane amount of temporary files. DefaultWagonManager in particular does that a lot, even though (at least in some cases) the file could have been deleted explicitly.

      For example, in the putRemoteFile method, the code reads as follows,

                  // We do this in here so we can checksum the artifact metadata too, otherwise it could be metadata itself
                  for ( Iterator i = checksums.keySet().iterator(); i.hasNext(); )
                  {
                      String extension = (String) i.next();
      
                      // TODO: shouldn't need a file intermediatary - improve wagon to take a stream
                      File temp = File.createTempFile( "maven-artifact", null );
                      temp.deleteOnExit();
                      FileUtils.fileWrite( temp.getAbsolutePath(), (String) sums.get( extension ) );
      
                      wagon.put( temp, remotePath + "." + extension );
                  }
      

      ... butI don't see why the temporary file cannot be deleted after the put method, or at least at the end of the method, after the Wagon component is released.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              kohsuke Kohsuke Kawaguchi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: