|Pack file handle remains open after using a shared repository [message #1394481]
||Sat, 05 July 2014 06:53
| Robin Shen
Registered: July 2014
With JGit, when operates against a shared repository (cloned from some other repository with "--shared" option), the opened pack file will remain open even if the shared repository is closed. To reproduce:
1. clone a shared repository from command line:
git clone --bare --shared /path/to/normal_repo /path/to/shared_repo
2. write a simple program containing below statements:
Repository repo = new FileRepository(new File("/path/to/shared_repo"));
// call log command to have JGit load the pack file
LogCommand log = new Git(repo1).log();
// sleep a while so that we can check opened file handles with some profiling tool
3. Now examine opened file handles of the program using some profile tools, and it turns out that JGit opened a RandomAccessFile handle to pack file under /path/to/normal_repo, which is correct. However this handle will not be closed after repo.close(). If we operate against the normal repository, the pack file handle will be closed right away after calling repo.close(). Ideally JGit should remain a reference count to the opened pack file handle, and then get it closed when no any repository is referencing it.
I am not sure if this is a bug or there is something I am not aware of. Please advice.
Powered by FUDForum
. Page generated in 0.02047 seconds