[issue1734] hg update and hg clone stuck with 100% CPU usage

Martin Geisler mercurial-bugs at selenic.com
Sun Jul 12 16:08:15 CDT 2009

New submission from Martin Geisler <mg at lazybytes.net>:

I'm suddenly seeing some very strange behavior with the current crew: I cannot
clone crew-stable and cannot update one of my crew-stable clones. I can update
my crew clone just fine (luckily!).

Bisecting shows that it started with

changeset:   9093:0b2b269ba3d0
parent:      9089:8ec39725d966
user:        Henrik Stuart <hg at hstuart.dk>
date:        Thu Jul 09 20:49:02 2009 +0200
summary:     branch heads: fix regression introduced in e67e5b60e55f (issue1726)

I can reproduce it with these commands. First I clone crew-stable with Mercurial
version 8ec39725d966:
% hg clone http://hg.intevation.org/mercurial/crew-stable
destination directory: crew-stable
requesting all changes
adding changesets
adding manifests
adding file changes
added 9031 changesets with 18051 changes to 1245 files
updating working directory
1062 files updated, 0 files merged, 0 files removed, 0 files unresolved

I then upgrade Mercurial to revision 0b2b269ba3d0 and do (this is with no
~/.hgrc file, hence the warning about no username):

% cd crew-stable
% hg backout 338412820a57
reverting templates/gitweb/map
reverting templates/monoblue/map
No username found, using 'mg at hbox.dyndns.org' instead
Waiting for Emacs...
created new head
changeset 9031:60c9fb9d2b09 backs out changeset 8493:338412820a57
the backout changeset is a new head - do not forget to merge
(use "backout --merge" if you want to auto-merge)
% hg update -C
330 files updated, 0 files merged, 36 files removed, 0 files unresolved
% hg tip
changeset:   9031:60c9fb9d2b09
tag:         tip
parent:      8493:338412820a57
user:        mg at hbox.dyndns.org
date:        Sun Jul 12 22:55:47 2009 +0200
summary:     Backed out changeset 338412820a57

% hg rollback
rolling back last transaction
% hg update -C

The final command uses 100% CPU and it looks like it's stuck. Running it with
--traceback gives tracebacks like this one (when I press Control-C):

% hg update --traceback -C
^CTraceback (most recent call last):
  File "/home/mg/src/mercurial-crew/mercurial/dispatch.py", line 43, in _runcatch
    return _dispatch(ui, args)
  File "/home/mg/src/mercurial-crew/mercurial/dispatch.py", line 449, in _dispatch
    return runcommand(lui, repo, cmd, fullargs, ui, options, d)
  File "/home/mg/src/mercurial-crew/mercurial/dispatch.py", line 317, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/home/mg/src/mercurial-crew/mercurial/dispatch.py", line 501, in _runcommand
    return checkargs()
  File "/home/mg/src/mercurial-crew/mercurial/dispatch.py", line 454, in checkargs
    return cmdfunc()
  File "/home/mg/src/mercurial-crew/mercurial/dispatch.py", line 448, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/home/mg/src/mercurial-crew/mercurial/util.py", line 375, in check
    return func(*args, **kwargs)
  File "/home/mg/src/mercurial-crew/mercurial/commands.py", line 3057, in update
    return hg.clean(repo, rev)
  File "/home/mg/src/mercurial-crew/mercurial/hg.py", line 342, in clean
    stats = _merge.update(repo, node, False, True, None)
  File "mercurial/merge.py", line 409, in update
    repo.dirstate.copy(f, fd)
  File "/home/mg/src/mercurial-crew/mercurial/localrepo.py", line 404, in branchtags
    for bn, heads in self.branchmap().iteritems():
  File "/home/mg/src/mercurial-crew/mercurial/localrepo.py", line 389, in branchmap
    self._branchtags(partial, lrev)
  File "/home/mg/src/mercurial-crew/mercurial/localrepo.py", line 367, in
    self._updatebranchcache(partial, lrev+1, tiprev+1)
  File "/home/mg/src/mercurial-crew/mercurial/localrepo.py", line 478, in
    reachable |= self.changelog.reachable(latest, bh)
  File "/home/mg/src/mercurial-crew/mercurial/revlog.py", line 573, in reachable
    for p in self.parents(n):
  File "/home/mg/src/mercurial-crew/mercurial/revlog.py", line 516, in parents
    d = i[self.rev(node)]

I've uploaded an example of such a repository here:


I cannot get it in good shape again, though it passes 'hg verify'. Updating to a
particular revision works, though:

% hg revert --all
reverting templates/gitweb/map
reverting templates/monoblue/map
% hg update tip
362 files updated, 0 files merged, 4 files removed, 0 files unresolved
% hg update

The final update ought to be very fast since we're already at tip, but we're
stuck in a loop in revlog.

messages: 10009
nosy: hstuart, mg
priority: urgent
status: unread
title: hg update and hg clone stuck with 100% CPU usage

Mercurial issue tracker <mercurial-bugs at selenic.com>

More information about the Mercurial-devel mailing list