Bug 4172 - hg recover aborts with "unknown exception encountered"
Summary: hg recover aborts with "unknown exception encountered"
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 2.9
Hardware: PC Linux
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-17 06:48 UTC by mcsmurf
Modified: 2014-07-19 14:17 UTC (History)
3 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mcsmurf 2014-02-17 06:48 UTC
My PC had a fatal hang while it did a "hg pull" or an "hg update" (not really sure) from http://hg.mozilla.org/mozilla-central. I now tried to run "hg recover", but unfortunately this fails with an unknown exception:
~/mercurial-2.9/hg recover
rolling back interrupted transaction
** unknown exception encountered, please report by visiting
** http://mercurial.selenic.com/wiki/BugTracker
** Python 2.7.3 (default, Sep 26 2013, 20:03:06) [GCC 4.6.3]
** Mercurial Distributed SCM (version 2.9)
** Extensions loaded: strip, mq
Traceback (most recent call last):
  File "/home/frank/mercurial-2.9/hg", line 38, in <module>
    mercurial.dispatch.run()
  File "/home/frank/mercurial-2.9/mercurial/dispatch.py", line 28, in run
    sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
  File "/home/frank/mercurial-2.9/mercurial/dispatch.py", line 69, in dispatch
    ret = _runcatch(req)
  File "/home/frank/mercurial-2.9/mercurial/dispatch.py", line 134, in _runcatch
    return _dispatch(req)
  File "/home/frank/mercurial-2.9/mercurial/dispatch.py", line 806, in _dispatch
    cmdpats, cmdoptions)
  File "/home/frank/mercurial-2.9/mercurial/dispatch.py", line 586, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/home/frank/mercurial-2.9/mercurial/dispatch.py", line 897, in _runcommand
    return checkargs()
  File "/home/frank/mercurial-2.9/mercurial/dispatch.py", line 868, in checkargs
    return cmdfunc()
  File "/home/frank/mercurial-2.9/mercurial/dispatch.py", line 803, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/home/frank/mercurial-2.9/mercurial/util.py", line 511, in check
    return func(*args, **kwargs)
  File "/home/frank/mercurial-2.9/mercurial/extensions.py", line 151, in wrap
    util.checksignature(origfn), *args, **kwargs)
  File "/home/frank/mercurial-2.9/mercurial/util.py", line 511, in check
    return func(*args, **kwargs)
  File "/home/frank/mercurial-2.9/hgext/mq.py", line 3381, in mqcommand
    return orig(ui, repo, *args, **kwargs)
  File "/home/frank/mercurial-2.9/mercurial/util.py", line 511, in check
    return func(*args, **kwargs)
  File "/home/frank/mercurial-2.9/mercurial/commands.py", line 4754, in recover
    if repo.recover():
  File "/home/frank/mercurial-2.9/mercurial/localrepo.py", line 865, in recover
    self.ui.warn)
  File "/home/frank/mercurial-2.9/mercurial/transaction.py", line 177, in rollback
    f, o = l.split('\0')
ValueError: need more than 1 value to unpack
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 66, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/home/frank/mercurial-2.9/mercurial/demandimport.py", line 111, in _demandimport
    return _hgextimport(_import, name, globals, locals, fromlist, level)
  File "/home/frank/mercurial-2.9/mercurial/demandimport.py", line 43, in _hgextimport
    return importfunc(name, globals, *args)
  File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
    from apport.report import Report
  File "/home/frank/mercurial-2.9/mercurial/demandimport.py", line 130, in _demandimport
    mod = _hgextimport(_origimport, name, globals, locals)
  File "/home/frank/mercurial-2.9/mercurial/demandimport.py", line 43, in _hgextimport
    return importfunc(name, globals, *args)
  File "/usr/lib/python2.7/dist-packages/apport/report.py", line 155, in <module>
    class Report(problem_report.ProblemReport):
  File "/home/frank/mercurial-2.9/mercurial/demandimport.py", line 102, in __getattribute__
    self._load()
  File "/home/frank/mercurial-2.9/mercurial/demandimport.py", line 74, in _load
    mod = _hgextimport(_import, head, globals, locals, None, level)
  File "/home/frank/mercurial-2.9/mercurial/demandimport.py", line 43, in _hgextimport
    return importfunc(name, globals, *args)
  File "/usr/lib/python2.7/dist-packages/problem_report.py", line 93, in <module>
    class ProblemReport(UserDict):
TypeError: Error when calling the metaclass bases
    module.__init__() takes at most 2 arguments (3 given)

Original exception was:
Traceback (most recent call last):
  File "/home/frank/mercurial-2.9/hg", line 38, in <module>
    mercurial.dispatch.run()
  File "/home/frank/mercurial-2.9/mercurial/dispatch.py", line 28, in run
    sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
  File "/home/frank/mercurial-2.9/mercurial/dispatch.py", line 69, in dispatch
    ret = _runcatch(req)
  File "/home/frank/mercurial-2.9/mercurial/dispatch.py", line 134, in _runcatch
    return _dispatch(req)
  File "/home/frank/mercurial-2.9/mercurial/dispatch.py", line 806, in _dispatch
    cmdpats, cmdoptions)
  File "/home/frank/mercurial-2.9/mercurial/dispatch.py", line 586, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/home/frank/mercurial-2.9/mercurial/dispatch.py", line 897, in _runcommand
    return checkargs()
  File "/home/frank/mercurial-2.9/mercurial/dispatch.py", line 868, in checkargs
    return cmdfunc()
  File "/home/frank/mercurial-2.9/mercurial/dispatch.py", line 803, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/home/frank/mercurial-2.9/mercurial/util.py", line 511, in check
    return func(*args, **kwargs)
  File "/home/frank/mercurial-2.9/mercurial/extensions.py", line 151, in wrap
    util.checksignature(origfn), *args, **kwargs)
  File "/home/frank/mercurial-2.9/mercurial/util.py", line 511, in check
    return func(*args, **kwargs)
  File "/home/frank/mercurial-2.9/hgext/mq.py", line 3381, in mqcommand
    return orig(ui, repo, *args, **kwargs)
  File "/home/frank/mercurial-2.9/mercurial/util.py", line 511, in check
    return func(*args, **kwargs)
  File "/home/frank/mercurial-2.9/mercurial/commands.py", line 4754, in recover
    if repo.recover():
  File "/home/frank/mercurial-2.9/mercurial/localrepo.py", line 865, in recover
    self.ui.warn)
  File "/home/frank/mercurial-2.9/mercurial/transaction.py", line 177, in rollback
    f, o = l.split('\0')
ValueError: need more than 1 value to unpack
Comment 1 mcsmurf 2014-02-17 07:13 UTC
Some additional info: "hg verify" took a very long time and printed like 150 pages or error messages. Someone on IRC then gave me tip to delete the last line in my .hg/store/journal file which was
data/gfx/gl/GLContext.h.d

Then I ran "hg recover" again which crashes with (German error message):
*** glibc detected *** python: double free or corruption (!prev): 0x000000001a44adb0 ***
browser/themes/osx/Toolbar-inverted.png@155489: entpacke d50acc03aae1: Integritätsprüfung fehlgeschlagen bei data/browser/themes/osx/Toolbar-inverted.png.i:0

"hg verify" then said (English error message, I switched locale):
browser/themes/osx/Toolbar-inverted.png@155489: unpacking d50acc03aae1: integrity check failed on data/browser/themes/osx/Toolbar-inverted.png.i:0
*** glibc detected *** python: double free or corruption (!prev): 0x0000000017e0f6e0 ***

In the end I decided to reclone the repository. Not sure if this bug here can actually be fixed, so feel free to close it ;)
Comment 2 Matt Mackall 2014-02-17 15:43 UTC
Ok, so the journal got corrupted interrupted mid-write here. This is apparently an exceedingly rare error: this code has existed for most of a decade without us getting a report on it.

Looks like the other corruption has been silently sitting in your repo for most of a year now.

I think about the only thing we can do here is catch the parsing error when reading the journal and complain.
Comment 3 HG Bot 2014-02-19 18:00 UTC
Fixed by http://selenic.com/repo/hg/rev/28b8ff84db3f
Matt Mackall <mpm@selenic.com>
journal: report parsing errors on recover/rollback (issue4172)

(please test the fix)