It shows that the files ending in .idx are so special that doesn't appear in the Python opened file list.
By debugging deep, it is found that the use of mmap.mmap(...) in pack.py(167)_load_file_contents would keep a file handle and there is no place to close the mmap. Perhaps this is where the file handle leak happen?
I've just downloaded Dulwich 0.6.0 and try out with the hg-git extension.
Combing Python debug mode with anatoly techtonik's "monkeypatching" code and file handle dumper, here is the result:
Output of printOpenFiles():
### 3 OPEN FILES: [R:\hg\ inspection\ .hg\hgrc, R:\hg\inspectio n\.hg\git\ objects\ pack\pack- 1a59751d438961f de15357f30146e3 0cc612fe34. pack, R:\hg\inspectio n\.hg\git\ objects\ pack\tmpqxvqyi. pack]
Partial output of handle -p hg.exe:
dc: File R:\hg\inspection n\.hg\git\ objects\ pack\pack- 1a59751d438961f de15357f30146e3 0cc612fe34. idx n\.hg\git\ objects\ pack\pack- fcdb717aa8f6344 11314e2b8288f17 333da2ed44. idx n\.hg\git\ objects\ pack\pack- 1a59751d438961f de15357f30146e3 0cc612fe34. pack n\.hg\git\ objects\ pack\tmprkzdib. pack n\.hg\hgrc
1e0: File R:\hg\inspectio
1e8: File R:\hg\inspectio
1ec: File R:\hg\inspectio
1f0: File R:\hg\inspectio
384: File R:\hg\inspectio
It shows that the files ending in .idx are so special that doesn't appear in the Python opened file list.
By debugging deep, it is found that the use of mmap.mmap(...) in pack.py( 167)_load_ file_contents would keep a file handle and there is no place to close the mmap. Perhaps this is where the file handle leak happen?