[Bug 3827] New: stale phasecache causes LookupError on branchmap.updatecache() after strip

mercurial-bugs at selenic.com mercurial-bugs at selenic.com
Sat Feb 16 20:47:57 CST 2013


http://bz.selenic.com/show_bug.cgi?id=3827

          Priority: normal
            Bug ID: 3827
                CC: mercurial-devel at selenic.com
          Assignee: bugzilla at selenic.com
           Summary: stale phasecache causes LookupError on
                    branchmap.updatecache() after strip
          Severity: bug
    Classification: Unclassified
                OS: Linux
          Reporter: yuya at tcha.org
          Hardware: PC
            Status: UNCONFIRMED
           Version: 2.5.1
         Component: Mercurial
           Product: Mercurial

Since Mercurial 2.5, the following steps result in LookupError: no node.

1. Process-A loads phaseroots
2. Process-B strips the node pointed by phaseroots
3. Process-A updates branchcache after repo.invalidate()

repo.invalidate() clears out most of cache data, but _phasecache isn't cleared.
This is the same for Mercurial 2.4, but 2.4 works well maybe because it doesn't
look up nodes by stale phasecache.

Script to reproduce
----
LANG=C
HGUSER=test
export HGUSER

#hg version -q
hg init issue2428
cd issue2428

cat <<EOF > .hg/hgrc
[defaults]
commit = -d "0 0"
[extensions]
mq =
EOF

touch toto
hg add toto
hg commit -m"add toto"
touch tata
hg add tata
hg commit -m"add tata"
hg up 0
touch titi
hg add titi
hg commit -m"add titi"
hg phase -p tip

{
    # load _phasecache.phaseroots
    printf 'runcommand\n\0\0\0\011phase\0-r1'
    sleep 1  # flush

    hg strip -r1 >&2  # by another process or thread

    # calls repo.invalidate() but _phasecache not cleared
    printf 'runcommand\n\0\0\0\010branches'
} | hg serve --cmdserver pipe --trace
----

Stack trace
----
Traceback (most recent call last):
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/dispatch.py", line
88, in _runcatch
    return _dispatch(req)
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/dispatch.py", line
743, in _dispatch
    cmdpats, cmdoptions)
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/extensions.py", line
189, in wrap
    return wrapper(origfn, *args, **kwargs)
  File "/home/yuya/.hgext/textful/__init__.py", line 152, in textfulcmd
    cmdoptions)
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/dispatch.py", line
514, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/extensions.py", line
189, in wrap
    return wrapper(origfn, *args, **kwargs)
  File "/home/yuya/work/hghacks/mercurial-stable/hgext/color.py", line 394, in
colorcmd
    return orig(ui_, opts, cmd, cmdfunc)
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/dispatch.py", line
833, in _runcommand
    return checkargs()
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/dispatch.py", line
804, in checkargs
    return cmdfunc()
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/dispatch.py", line
740, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/util.py", line 475,
in check
    return func(*args, **kwargs)
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/extensions.py", line
144, in wrap
    util.checksignature(origfn), *args, **kwargs)
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/util.py", line 475,
in check
    return func(*args, **kwargs)
  File "/home/yuya/work/hghacks/mercurial-stable/hgext/mq.py", line 3508, in
mqcommand
    return orig(ui, repo, *args, **kwargs)
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/util.py", line 475,
in check
    return func(*args, **kwargs)
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/commands.py", line
967, in branches
    for tag, heads in repo.branchmap().iteritems():
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/localrepo.py", line
634, in branchmap
    branchmap.updatecache(self)
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/branchmap.py", line
75, in updatecache
    partial = subset.branchmap().copy()
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/localrepo.py", line
634, in branchmap
    branchmap.updatecache(self)
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/branchmap.py", line
75, in updatecache
    partial = subset.branchmap().copy()
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/localrepo.py", line
634, in branchmap
    branchmap.updatecache(self)
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/branchmap.py", line
62, in updatecache
    cl = repo.changelog
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/repoview.py", line
170, in changelog
    revs = filterrevs(unfi, self.filtername)
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/repoview.py", line
117, in filterrevs
    repo.filteredrevcache[filtername] = func(repo.unfiltered())
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/repoview.py", line
68, in computemutable
    maymutable = filterrevs(repo, 'base')
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/repoview.py", line
117, in filterrevs
    repo.filteredrevcache[filtername] = func(repo.unfiltered())
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/repoview.py", line
92, in computeimpactable
    firstmutable = min(firstmutable, min(cl.rev(r) for r in roots))
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/repoview.py", line
92, in <genexpr>
    firstmutable = min(firstmutable, min(cl.rev(r) for r in roots))
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/changelog.py", line
184, in rev
    r = super(changelog, self).rev(node)
  File "/home/yuya/work/hghacks/mercurial-stable/mercurial/revlog.py", line
293, in rev
    raise LookupError(node, self.indexfile, _('no node'))
LookupError: 00changelog.i at 92a86c53f65b: no node
----

This issue was originally reported to TortoiseHg:
https://bitbucket.org/tortoisehg/thg/issue/2428/strip-revisions-with-some-specific-phase

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list