Hg Git Pull 引发了过多打开文件错误。

3

我有一个Mercurial版本库,用来追踪一个git版本库。在Windows 10上它工作得很好。现在我将其作为目录移动到Mac上,然后运行hg reset -Ca以清理它。现在我尝试运行hg pull,但是会出现以下错误:

% hg --traceback --verbose pull                                                                                                255 ↵
pulling from git+https://someserver/somerepo.git
Traceback (most recent call last):
  File "/Users/user/.pyenv/versions/2.7.14/lib/python2.7/site-packages/mercurial/scmutil.py", line 154, in callcatch
  File "/Users/user/.pyenv/versions/2.7.14/lib/python2.7/site-packages/mercurial/dispatch.py", line 314, in _runcatchfunc
.....
  File "/Users/user/.pyenv/versions/2.7.14/lib/python2.7/site-packages/dulwich/pack.py", line 1004, in __init__
  File "/Users/user/.pyenv/versions/2.7.14/lib/python2.7/site-packages/dulwich/file.py", line 90, in GitFile
IOError: [Errno 24] Too many open files: '/Users/user/Projects/somerepo/.hg/git/objects/pack/pack-c03bf69ae597535d876f0dd30ddd6458f2c3f1ff.pack'
abort: Too many open files: /Users/user/Projects/somerepo/.hg/git/objects/pack/pack-c03bf69ae597535d876f0dd30ddd6458f2c3f1ff.pack

我检查过了,看起来我已经拥有最新版本的hg-gitdulwich
dulwich (0.18.6)
hg-git (0.8.10)

Mercurial也是最新版本

% hg --version 
Mercurial Distributed SCM (version 4.5)

我检查了Windows上Mercurial的版本,版本号是4.4.2,不知道这是否有影响。我想知道是否有人遇到过类似的问题,或者可能有解决方法。

1个回答

7

ulimit -n在你的Mac上是什么意思?它限制了打开文件的数量。试着运行ulimit -n N,其中N比之前的值更大,然后再次运行hg命令。

如果你遇到这个问题不止一次,你可能需要将ulimit -n N命令放到你的~/.bashrc文件中,在每次登录时都执行它。


3
出人意料,它确实有所帮助。我通过 sysctl 检查了打开文件的数量。 sysctl kern.maxfiles 返回 kern.maxfiles: 49152sysctl kern.maxfilesperproc 返回 kern.maxfilesperproc: 24576。 使用 ulimit -n 返回 256。调用 ulimit -n 512 解决了问题。 - EvgeniySharapov

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接