summaryrefslogtreecommitdiff
path: root/t/t3903-stash.sh
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2011-02-28 12:52:39 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-02-28 13:08:31 -0800
commitc7934306d1504325d26950f35759ad478772e9c3 (patch)
treeae320f10ba4391206d3a2aaba7f706569e2ce5ce /t/t3903-stash.sh
parentbranch_merged: fix grammar in warning (diff)
downloadtgif-c7934306d1504325d26950f35759ad478772e9c3.tar.xz
Limit file descriptors used by packs
Rather than using 'errno == EMFILE' after a failed open() call to indicate the process is out of file descriptors and an LRU pack window should be closed, place a hard upper limit on the number of open packs based on the actual rlimit of the process. By using a hard upper limit that is below the rlimit of the current process it is not necessary to check for EMFILE on every single fd-allocating system call. Instead reserving 25 file descriptors makes it safe to assume the system call won't fail due to being over the filedescriptor limit. Here 25 is chosen as a WAG, but considers 3 for stdin/stdout/stderr, and at least a few for other Git code to operate on temporary files. An additional 20 is reserved as it is not known what the C library needs to perform other services on Git's behalf, such as nsswitch or name resolution. This fixes a case where running `git gc --auto` in a repository with more than 1024 packs (but an rlimit of 1024 open fds) fails due to the temporary output file not being able to allocate a file descriptor. The output file is opened by pack-objects after object enumeration and delta compression are done, both of which have already opened all of the packs and fully populated the file descriptor table. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3903-stash.sh')
0 files changed, 0 insertions, 0 deletions