Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Files remaining locked after repository close in Windows

On Wed, Dec 19, 2012 at 1:47 PM, Mike Youngstrom <youngm@xxxxxxxxx> wrote:
> I've seen several posts about repository locking from the eGit side but
> haven't really seen any solutions.
> I'm using jgit
> The following code fails in windows because some .pack files remain locked
> until my VM closes.  Any ideas what I'm doing wrong?  Here is a test case
> going against a test github repository I have set up so you should be able
> to just copy and run.
> The error I see in windows is:
> Exception in thread "main" java.nio.file.AccessDeniedException:
> C:\Users\YOUNGS~1\AppData\Local\Temp\temp_git_repo752040393604081653\.git\objects\pack\pack-1edb465f57d546b7c6343b02c151cb3bdd68ef87.idx

This is... odd. JGit shouldn't be keeping a .idx file open. This would
appear to be a leaked resource handle. We do keep .pack files open,
but those are supposed to be closed when you call close() on the
Repository object, assuming the number of close calls matches the
number of open increments that were performed on the Repository

But .idx files are always handled as open, read entire file, close. We
shouldn't ever be keeping the .idx file handle open. So this sounds
like a resource leak.

Back to the top