Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 358725

Summary: hggit: too many open files on hg pull
Product: Gentoo Linux Reporter: Fabian Groffen <grobian>
Component: New packagesAssignee: Dirkjan Ochtman (RETIRED) <djc>
Status: RESOLVED INVALID    
Severity: normal CC: grobian
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://github.com/schacon/hg-git/issues/176
Whiteboard:
Package list:
Runtime testing required: ---

Description Fabian Groffen gentoo-dev 2011-03-13 16:16:33 UTC
% hg pull pulling from git+ssh://git@git.overlays.gentoo.org/proj/portage.git
importing Hg objects into Git
["git-upload-pack '/proj/portage.git'"] Counting objects: 3664, done.
Compressing objects: 100% (2573/2573), done.
Total 3664 (delta 2289), reused 1743 (delta 1091)
importing Git objects into Hg
abort: Too many open files: /export/gentoo/portage-hg/.hg/git/objects/pack/pack-9fb8d5a8932a495a2ed28ac993b4329a1ad3c680.pack
%

This problem stems from commit https://github.com/schacon/hg-git/commit/59c7b6d804126bde4fb85409b1cc66c01de4132c the code block for hgrepo.py around line 50 opens tf, but doesn't close it. Adding tf.close() after the tf.read line, resolves the too many open files problem.


patch is simple and straightforward:
--- hgrepo.py.orig       2011-03-13 17:09:21.000000000 +0100
+++ hgrepo.py     2011-03-13 17:09:43.000000000 +0100
@@ -55,6 +55,7 @@
             if os.path.exists(tagfile):
                 tf = open(tagfile, 'rb')
                 tagdata = tf.read().split('\n')
+                tf.close()
                 td = [line.split(' ', 1) for line in tagdata if line]
                 return dict([(name, bin(sha)) for sha, name in td])
             return {}

already reported upstream
Comment 1 Fabian Groffen gentoo-dev 2011-03-13 16:59:38 UTC
the fix works on the platform I tested by coincidence, the real problem is in dulwich, so closing.  sorry for the noise.