3

I have a Mercurial repository that tracks a git repository. It was working ok on Windows 10. Now I moved it to a Mac as a directory, then ran hg reset -Ca just to clean it up. Now I am trying to run hg pull It causes an error like this:

% 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

I checked and it looks like I have latest versions of hg-git and dulwich

dulwich (0.18.6)
hg-git (0.8.10)

Mercurial is also up to date

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

I checked version of Mercurial on Windows and it is 4.4.2 if that matters. I wonder if anyone had an issue like that and perhaps has a work around or fix.

Taku
  • 31,927
  • 11
  • 74
  • 85
EvgeniySharapov
  • 3,078
  • 3
  • 27
  • 38

1 Answers1

7

What does ulimit -n say on your Mac? This is the limit on the number of open files. Try then running ulimit -n N for some larger N than what it was previously, and run the hg command again.

You may want to put the ulimit -n N command in your ~/.bashrc to run it every time you log in, if you have this problem more than just this once.

Robert Tupelo-Schneck
  • 10,047
  • 4
  • 47
  • 58
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
  • 3
    Surprisingly it did help. I was checking number of open files via `sysctl`. `sysctl kern.maxfiles` returned `kern.maxfiles: 49152` `sysctl kern.maxfilesperproc` returned `kern.maxfilesperproc: 24576` Using `ulimit -n` returned 256. Calling `ulimit -n 512` fixed the issue. – EvgeniySharapov Feb 09 '18 at 18:15