It appears as though SVNWClient.doCleanup
does not release its lock on the working copy database once the operation has completed.
This was discovered while writing a JUnit5 test that creates a local filesystem repository inside a temporary directory which is automatically created before and deleted after each test. Deletion of the temporary directory fails after calling doCleanup
due to the following cause:
java.nio.file.FileSystemException: C:\Users\sgreen\AppData\Local\Temp\junit2931781630062626873\working-copy\.svn\wc.db: The process cannot access the file because it is being used by another process.
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269)
at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
at java.nio.file.Files.delete(Files.java:1126)
at org.junit.jupiter.engine.extension.TempDirectory$CloseablePath$1.deleteAndContinue(TempDirectory.java:206)
at org.junit.jupiter.engine.extension.TempDirectory$CloseablePath$1.visitFile(TempDirectory.java:196)
at org.junit.jupiter.engine.extension.TempDirectory$CloseablePath$1.visitFile(TempDirectory.java:192)
at java.nio.file.Files.walkFileTree(Files.java:2670)
at java.nio.file.Files.walkFileTree(Files.java:2742)
at org.junit.jupiter.engine.extension.TempDirectory$CloseablePath.deleteAllFilesAndDirectories(TempDirectory.java:192)
at org.junit.jupiter.engine.extension.TempDirectory$CloseablePath.close(TempDirectory.java:180)
... 82 more
This does not happen for any of the other client methods being used in the same test context.
An example gradle project with the issue can be found here: Bitbucket
openjdk version “11.0.11” 2021-04-20 LTS
svnkit version 1.10.3