Skip to content

Jgit does not release pack files after proper closure #185

@vrosu

Description

@vrosu

Version

6.10.1.202505221210-r

Operating System

Windows

Bug description

Create Git object based on a bare repo.
Set it to mirror a remote repo
Execute Pull
Close the repository will all available methods:

  1. FileRepository close (we observe useCnt = 0)
  2. RepositoryCache.clear()
  3. Git.close()
  4. WindowCacheConfig wconfig = new WindowCacheConfig();
    wconfig.setPackedGitMMAP(false);
    WindowCache.reconfigure(wconfig);
    Step 4 is based on other bug reports about this behavior
  5. Thread.sleep(4000) - in case other threads need to finish some work
  6. Delete the git folder on disk via recursive methods

Actual behavior

Error removing file \GitRepository\AT19021222.git\objects\pack\pack-0ae6de42f7a464520ac14706e3e385c0ca62c94d.idx; Error: java.nio.file.AccessDeniedException
Error removing file \GitRepository\AT19021222.git\objects\pack\pack-0ae6de42f7a464520ac14706e3e385c0ca62c94d.pack; Error: java.nio.file.AccessDeniedException

These are all the open files that can't be removed. All other Git files can safely be deleted.

Expected behavior

I would expect that these files can be deleted.

Relevant log output

Pasted as image in the other information. I am using source code and littered the code with some debug statements.
Note that WindowCache is never using mmap.
The exception for deleting the file from Java is observed at 14:33:55.916
Using the Process Monitor, I observe that as soon as the failure happens, the file is closed. Removing the file from Windows Explorer then works.

Other information

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    not jgitIssue not in JGit

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions