[GRADLE-462] Gradle doesn't clean up temp files Created: 27/Apr/09  Updated: 04/Jan/13  Resolved: 22/Aug/09

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 0.8

Type: Bug
Reporter: Steve Appling Assignee: Steve Appling
Resolution: Fixed Votes: 0


 Description   

After normal operations, Gradle leaves a large number of files in the user's temp directory. One of our developers had over 22,000 gradle_ivy_cache* directories.

These are being created by DefaultResolverFactory.createTmpDir, but it wasn't obvious to me when it was safe to delete them.

There are also a large number of groovy-generated-*-java-source directories that seem to be generated during gradle builds, but it is not obvious where this is being done.



 Comments   
Comment by Hans Dockter [ 01/May/09 ]

The groovy-generated-*-java directories are produced by the Groovy's Ant Groovyc task. This means at the moment this is not in our hands (in the long term we want to get rid of all the internally used ant tasks).

I'm not sure yet what to do about the gradle_ivy_cache dirs. Anyway, all of the dirs (including groovy-generated-...) can be deleted after a build.

Comment by Steve Appling [ 29/Jun/09 ]

I think this is causing us some performance issues over time. I had over 50,000 of these in my temp directory after about a month. This starts making creation of new temp files slower. It will not be obvious to people to manually clean this up.

Can't the gradle_ivy_cache dirs be marked as delete on exit if you can't figure out when you are done with them?

Is there any information we can read from the ant groovyc task with the new AntTaskAccess listener to know what directories to delete?

I would like to see this fixed in 0.7 if possible.

Comment by Steve Appling [ 30/Jul/09 ]

There are 4 different types of garbage left in the temp directory:

  1. gradle_ivy_cache* dirs
  2. groovy-generated-* dirs
  3. gradle_*tarMergeGroup dirs
  4. testng* files
Comment by Steve Appling [ 04/Aug/09 ]

After some investigation:

  1. gradle_ivy_cache* dirs
    These were created by DefaultResolverFactory as part of making FileSystemResolvers. It was not clear when the resolver was done with them so they were never deleted. I added code to delete them on exit.
  2. groovy-generated-* dirs
    This seems to be a subtle bug in groovy. Most of the groovy-generated dirs are appropriately deleted, but occasionally (enough to be really annoying) some are left. The groovy source for compiling these seems correct, but hard to debug since it is happening in a forked process. I'll try to look into it more, but I don't have high hopes for solving this one myself.
  3. gradle_*tarMergeGroup dirs
    We were creating these dirs in AntTar and not deleting them. I added code to clean up the directories at the end of the task.
  4. testng* files
    These are only showing up because our TestNG samples have the option "dumpCommand" turned on. I've asked Tom if we can remove this.
Comment by Steve Appling [ 22/Aug/09 ]

Removed the dumpCommand option from the TestNG samples.

Comment by Steve Appling [ 22/Aug/09 ]

The only issue left is the groovy-generated-* dirs. These are only caused by the GroovyProjectSampleIntegrationTest.groovy1_5_6Sample. In 1.5.6, these directories were not cleaned up correctly, but it isn't an issue any more. I'm closing this bug.

Generated at Wed Jun 30 11:30:43 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.