Systematic error pulling from any repo

Hello

I am having the exact same issue that was reported by somebody else here (about two years ago):
https://secure.phabricator.com/T12521

That report contains steps to reproduce, detailed debug information and (in a comment about a year ago) seems to point to the real root of the issue.

For me the steps that reproduce are:

  • have a full “working” installation of Phabricator (working as in except for this issue) and some repos
  • from a hg client do: hg pull https://myphabricatorserver.com/source/myrepo or whatever the pull command is (I’m writing by memory).

(obviously, it won’t reproduce for you out of the box. I don’t know what conditions are required for it to reproduce with the above steps. Nobody does, otherwise it would be fixed already. But those are the steps).

Expected:
succesfull pull.
Second best expected: an informative error if something is actually wrong. On the server, mercurial is exiting with an error that includes a detailed debug trace that would have helped a lot in finding what’s wrong. The actual error from hg on the server is (took me several hours of debugging to figure out):

** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 2.7.16 (default, Oct 10 2019, 22:02:15) [GCC 8.3.0]
** Mercurial Distributed SCM (version 4.8.2)
** Extensions loaded: 
Traceback (most recent call last):
  File "/usr/bin/hg", line 43, in <module>
    dispatch.run()
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 96, in run
    status = dispatch(req)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 220, in dispatch
    ret = _runcatch(req) or 0
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 363, in _runcatch
    return _callcatch(ui, _runcatchfunc)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 371, in _callcatch
    return scmutil.callcatch(ui, func)
  File "/usr/lib/python2.7/dist-packages/mercurial/scmutil.py", line 166, in callcatch
    return func()
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 354, in _runcatchfunc
    return _dispatch(req)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 994, in _dispatch
    cmdpats, cmdoptions)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 737, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 1003, in _runcommand
    return cmdfunc()
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 991, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
  File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 1646, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mercurial/commands.py", line 5207, in serve
    s.serve_forever()
  File "/usr/lib/python2.7/dist-packages/mercurial/wireprotoserver.py", line 797, in serve_forever
    self.serveuntil(threading.Event())
  File "/usr/lib/python2.7/dist-packages/mercurial/wireprotoserver.py", line 804, in serveuntil
    _runsshserver(self._ui, self._repo, self._fin, self._fout, ev)
  File "/usr/lib/python2.7/dist-packages/mercurial/wireprotoserver.py", line 656, in _runsshserver
    rsp = wireprotov1server.dispatch(repo, proto, request)
  File "/usr/lib/python2.7/dist-packages/mercurial/wireprotov1server.py", line 72, in dispatch
    args = proto.getargs(spec)
  File "/usr/lib/python2.7/dist-packages/mercurial/wireprotoserver.py", line 505, in getargs
    arg, l = argline.split()
ValueError: need more than 0 values to unpack

Observed: the hg client receives this uninformative error:

HTTP Error: 500 (Error 1: ** unknown exception encountered, please report by visiting)

(it’s the error from the server above but truncated to the first line which is worthless).

I assumed that there was something I was actually doing wrong, perhaps with my Mercurial configuration (I’m migrating a fully working setup from a machine to another and thought I had missed some step), and that Phabricator’s only fault was not providing all the information about the error. It’s still a possibility (if that’s the case, the truncation of the error message alone is still a significant bug); however the thread above seems to indicate that there is actually a bug in Phabricator not passing all the command arguments to Mercurial as expected (namely the argument “bookmarks” to the command “listkeys”).

This other post from a month ago seems to point to some sort of solution; it kind of looks like a workaround to me, but I have no idea as it edits the Phabricator source code and I don’t understand it.
I haven’t tested it:

Here’s my version information:

phabricator54bcbdaba94a3573e128c6498816dbfa41d3a9cb (Fri, Dec 13)arcanist3cdfe1fff806d2b54a2df631cf90193e518f42b7 (Sep 5 2019)phutilf51f1b3f72b50246949d0917239ca84f39ec7a54 (Sep 2 2019)php7.3.11-1~deb10u1diff3.7 at /usr/bin/diffgit2.20.1 at /usr/bin/githg4.8.2 at /usr/bin/hgpygmentize2.5.2 at /usr/local/bin/pygmentizesvnNot Available

(I copied and pasted it from Config->Version Information and it comes out poorly formatted like that)

1 Like

The workaround in the post cited above actually works for me (I needed to fix the ‘’ characters but other than that).

I have no idea what it really does, but it fixed the issue.