You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Paul Benedict (JIRA)" <ji...@codehaus.org> on 2014/07/02 15:45:02 UTC
[jira] (MNG-3492) File.deleteOnExit not enough for embedder&CI
[ https://jira.codehaus.org/browse/MNG-3492?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Benedict updated MNG-3492:
-------------------------------
Fix Version/s: (was: Issues to be reviewed for 3.x)
> File.deleteOnExit not enough for embedder&CI
> --------------------------------------------
>
> Key: MNG-3492
> URL: https://jira.codehaus.org/browse/MNG-3492
> Project: Maven
> Issue Type: Bug
> Components: Artifacts and Repositories
> Affects Versions: 2.0.7
> Reporter: Kohsuke Kawaguchi
>
> 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,
> {noformat}
> // 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 );
> }
> {noformat}
> ... 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.
--
This message was sent by Atlassian JIRA
(v6.1.6#6162)