-
Notifications
You must be signed in to change notification settings - Fork 118
Description
The proj I'm working on is using the lib into automation test suits. Tests are being run by Jenkins and Jenkins being hosted on a bare metal. From time to time I'm facing with
IOException: No space left on device
It appears the lib is flooding /tmp directory with numerous of config file repo clones, e.g.:
jenkins@jenkinsmaster01:~$ ls -ld /tmp/cfg*
drwxr-xr-x 4 jenkins jenkins 4096 May 23 00:21 /tmp/cfg4j-git-config-repository1196432648052804977
drwxr-xr-x 3 jenkins jenkins 4096 May 19 17:36 /tmp/cfg4j-git-config-repository1210794336978573061
...
'a lot of same directories goes here'
...
Here's the place where the path being initialized:
cfg4j/cfg4j-git/src/main/java/org/cfg4j/source/git/GitConfigurationSourceBuilder.java
Line 58 in 47d4f63
| tmpPath = Paths.get(System.getProperty("java.io.tmpdir")); |
cfg4j/cfg4j-git/src/main/java/org/cfg4j/source/git/GitConfigurationSourceBuilder.java
Line 59 in 47d4f63
| tmpRepoPrefix = "cfg4j-git-config-repository"; |
Each run new randomly named dir is created and NOT being cleared after:
| clonedRepoPath = Files.createTempDirectory(tmpPath, tmpRepoPrefix); |
I have a feeling this was intended to clear old copies, but in fact it doesn't as each time new random long is being appended to the path and old dirs is not deleted.
| Files.delete(clonedRepoPath); |
Given above:
- I believe it is must for documentation to mention that repo would be cloned to System temp directory and furthermore I believe the directory should be configurable, as a workaround I'm passing:
-Djava.io.tmpdir={not-root/custom tmp dir}to java. - Code should be updated so it would clear all the leftovers after its execution.