Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Auto gc in background thread prevents deleting repositories

On Sun, Jun 25, 2017 at 11:35 AM, RĂ¼diger Herrmann <ruediger.herrmann@xxxxxx> wrote:
Hi,

I have a test suite that - for each test - creates a temporary repository and deletes it after the test was run. Deleting is implemented with recursively calling File::delete() for each file in the repository's directory.

After updating to JGit 4.7.1, I occasionally see repositories that cannot be deleted because deleting the file .git/gc.log.lock fails (i.e. File::delete() returns false). Note that the code correctly closes the repository before deleting the respective directory.

It seems that the auto gc code does not stop if a repository has been/is being closed and thus prevents it from being deleted properly.

I currently configure the test repositories to skip auto gc in order to work around this issue. However in use cases where auto gc is desired, accessing repositories beyond their life cycle may still have unwanted side effects.

I agree that jgit should cancel a possibly running asynchronous gc and unlock gc.log.lock
in case the repository is closed. Sounds like we need another event type asynchronous
gc should register for. Or/and a way to observe gc running in the background.

-Matthias


Back to the top