Subject: Re: [PATCH/RFC 1/2] sha1_file: close all pack files after running

From: Max Kirillov <[email-masked]>
Date: Fri, 2 Oct 2015 23:06:49 +0300

On Fri, Oct 02, 2015 at 10:06:46PM +0300, Max Kirillov wrote:
> for i in $(seq 1000)
> t_git -c core.packedGitWindowSize=100 log

It was 32-bit build.
I cannot promise those exactly numbers will work, because I don not clearly
understand what do they mean. With 100 commits the pack size was 20K, but it
was mapped fully with the window=100.

But I believe with the same build same numbers should reproduce the issue.

For 32-bit builds I can see it on any significantly big repository, like the
git itself. Maybe for 64bit it is less likely.

The code which decides whether to close the pack is in use_pack() in sha1_file.c:
-----------
                        if (!win->offset && win->len == p->pack_size
                                && !p->do_not_close) {
                                close(p->pack_fd);
                                pack_open_fds--;
                                p->pack_fd = -1;
                        }
-----------