strip crash: IndexError in revlog.node()

Greg Ward greg at gerg.ca
Wed Feb 15 17:02:59 CST 2012


Hi all --

I've found a bug in strip in 2.1 that I'm having a hard time reducing
to a small test case. The good news is that it's 100% reproducible
with an artificial test repository, and I have bisected to find the
responsible changeset. But I haven't been able to figure what it is
about the topology of my test repo that tickles the bug.

First, here is the crash:

"""
$ export HGRCPATH=''
$ hg --config extensions.mq= strip --debug 75 79
6 changesets found
list of changesets:
c38cda5d9ab53f6a36547976641ab686ff1eb115
d6d6ec546b86399acbd0f68332991590ce0238c4
70e02bd677128d0903ff34edfc5f662e94f1de50
69470e76eb80f45ecb94edb8b140be542f881525
9fbf5255ad5901848ecef7d633fd696d507c3003
11087cd5188ca9a71f7cc355f0d8516e037de46f
bundling: 1/6 changesets (16.67%)
bundling: 2/6 changesets (33.33%)
bundling: 3/6 changesets (50.00%)
bundling: 4/6 changesets (66.67%)
bundling: 5/6 changesets (83.33%)
bundling: 6/6 changesets (100.00%)
bundling: 1/4 manifests (25.00%)
bundling: 2/4 manifests (50.00%)
bundling: 3/4 manifests (75.00%)
saved backup bundle to
/tmp/stripbug/repo1/.hg/strip-backup/c38cda5d9ab5-backup.hg
1 changesets found
list of changesets:
4b5076413f96199f816ee6946e2683dd97c42e43
bundling: 1/1 changesets (100.00%)
bundling: 1/1 manifests (100.00%)
adding branch
adding changesets
changesets: 1 chunks
add changeset 4b5076413f96
adding manifests
manifests: 1/1 chunks (100.00%)
adding file changes
added 1 changesets with 0 changes to 0 files
5 changesets found
list of changesets:
d0cba608112496afbccd087f953a914fa0936770
9a61e11a7252932b52769afa52c98a2b852c2aab
ebaf4971568bc76d612058f14e575d559f244909
714ebd7b8d75bcb934160885dd30cf52f36bb41b
4b5076413f96199f816ee6946e2683dd97c42e43
bundling: 1/5 changesets (20.00%)
bundling: 2/5 changesets (40.00%)
bundling: 3/5 changesets (60.00%)
bundling: 4/5 changesets (80.00%)
bundling: 5/5 changesets (100.00%)
bundling: 1/4 manifests (25.00%)
bundling: 2/4 manifests (50.00%)
bundling: 3/4 manifests (75.00%)
bundling: 4/4 manifests (100.00%)
bundling: feature 1/2 files (50.00%)
bundling: hamlet.txt 2/2 files (100.00%)
saved backup bundle to
/tmp/stripbug/repo1/.hg/strip-backup/d0cba6081124-backup.hg
updating the branch cache
invalidating branch cache (tip differs)
** unknown exception encountered, please report by visiting
**  http://mercurial.selenic.com/wiki/BugTracker
** Python 2.7.2 (default, Oct 27 2011, 01:40:22) [GCC 4.6.1 20111003
(Red Hat 4.6.1-10)]
** Mercurial Distributed SCM (version 2.1+22-f7e0d95d0a0b)
** Extensions loaded: mq
Traceback (most recent call last):
  File "/home/gward/bin/hg", line 38, in <module>
    mercurial.dispatch.run()
  File "/home/gward/src/mercurial-intelerad/mercurial/dispatch.py",
line 27, in run
    sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
  File "/home/gward/src/mercurial-intelerad/mercurial/dispatch.py",
line 64, in dispatch
    return _runcatch(req)
  File "/home/gward/src/mercurial-intelerad/mercurial/dispatch.py",
line 87, in _runcatch
    return _dispatch(req)
  File "/home/gward/src/mercurial-intelerad/mercurial/dispatch.py",
line 683, in _dispatch
    cmdpats, cmdoptions)
  File "/home/gward/src/mercurial-intelerad/mercurial/dispatch.py",
line 465, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/home/gward/src/mercurial-intelerad/mercurial/dispatch.py",
line 737, in _runcommand
    return checkargs()
  File "/home/gward/src/mercurial-intelerad/mercurial/dispatch.py",
line 691, in checkargs
    return cmdfunc()
  File "/home/gward/src/mercurial-intelerad/mercurial/dispatch.py",
line 680, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/home/gward/src/mercurial-intelerad/mercurial/util.py", line
456, in check
    return func(*args, **kwargs)
  File "/home/gward/src/mercurial-intelerad/hgext/mq.py", line 2844, in strip
    force=opts.get('force'))
  File "/home/gward/src/mercurial-intelerad/hgext/mq.py", line 1052, in strip
    release(lock, wlock)
  File "/home/gward/src/mercurial-intelerad/mercurial/lock.py", line
143, in release
    lock.release()
  File "/home/gward/src/mercurial-intelerad/mercurial/lock.py", line
138, in release
    callback()
  File "/home/gward/src/mercurial-intelerad/mercurial/localrepo.py",
line 2164, in runhooks
    self.hook("changegroup", node=hex(cl.node(clstart)),
  File "/home/gward/src/mercurial-intelerad/mercurial/revlog.py", line
309, in node
    return self.index[rev][7]
IndexError: list index out of range
"""

Second, here is the topology of the test repo that just happened to
tickle this bug:

"""
$ hg --config extensions.graphlog= glog -q
o    85:11087cd5188c
|\
| o    84:9fbf5255ad59
| |\
o \ \    83:69470e76eb80
|\ \ \
| | | o    82:70e02bd67712
| | | |\
| | o \ \    81:4b5076413f96
| | |\ \ \
| o-------+  80:d6d6ec546b86
| | | | | |
| | +-----o  79:c38cda5d9ab5
| | | | | |
o-------+ |  78:714ebd7b8d75
|/ / / / /
| | | o /  77:ebaf4971568b
| | |/|/
| | o |    76:9a61e11a7252
| | |\ \
| | | o |  75:d0cba6081124
| | | | |
o | | | |  74:34ceb36ca76c
| | | | |
| | | | | o  73:73cb979764e2
| | | | | |
o | | | | |    72:4d5978706d40
|\ \ \ \ \ \
| o-------+ |  71:b9d84f1dab48
| | | | | | |
| o | | | | |    70:071d1739296e
| |\ \ \ \ \ \
o | | | | | | |  69:61ee9dd09623
| | | | | | | |
o | | | | | | |  68:c6c998ee817a
| | | | | | | |
o | | | | | | |  67:ae9a3e91ed20
| | | | | | | |
| | o | | | | |  66:9fdcf0e0193d
| | | | | | | |
| | | | | | o |    65:b540ff1eeef5
| | | | | | |\ \
| +-----------o |  64:ea4debcc6fdb
| | | | | | |  /
| o-----------+  63:9085b57b84a5
| | | | | | | |
| | | | | | o |  62:b3c153b932ba
| | | | | | | |
| +---------o |  61:01ff70498967
| | | | | |  /
o | | | | | |  60:c153e0365d41
| | | | | | |
o | | | | | |  59:8ef9ff41c4ab
| | | | | | |
| o | | | | |  58:f81b53a4b847
| | | | | | |
| | | | | | o    57:05d5c0dc566c
| | | | | | |\
| | | | | | | o  56:726f72cf401f
| | | | | | | |
| | o | | | | |  55:7f744b75d28f
| | | | | | | |
| o | | | | | |  54:a1fafcff7272
| |/ / / / / /
| o | | | | |  53:fcd929c855db
| | | | | | |
| | | | | o |  52:1cebbdfc4568
| | | | | | |
| | | | | | o  51:2ef36a3e40b0
| | | | | | |
| o | | | | |  50:19bc806cad9f
| | | | | | |
| | o | | | |  49:6bb163f5aed5
| | |/ / / /
| | o / / /  48:4177f885728f
| |/ / / /
| | o | |  47:572bc52f603c
| | | | |
| o | | |  46:564c3a09b1d7
| | | | |
| | o | |  45:838352d2ede1
| | | | |
| | o | |  44:5ad3630eb143
| |/ / /
| o | |  43:a6d6157a2280
| | | |
| | | | o  42:3f39e8bb09c9
| | | | |
| | | | o  41:f08da2716c56
| | | | |
| | | o |  40:3f6e96392e75
| | | | |
| o | | |  39:bea8f24f443f
| |/ / /
| | | o  38:d57007e14d9e
| | | |
| | o |  37:2d1ab41a5718
| | | |
| | o |  36:4af81a3451e9
| |/ /
| | | o  35:be76e184760b
| | | |
| o | |  34:eb6fd89c3564
|/ / /
o | |  33:ab02378f2b35
| | |
| | o  32:983b20a40169
| | |
| o |  31:24d84d8572fc
| | |
| o |  30:fbc5461005ec
| | |
| | | o  29:9bdf79945b1d
| | | |
o | | |  28:cec2ea5c1edd
| | | |
| o | |  27:32a1b058c0e9
| | | |
o | | |  26:fc0fe9618c6a
| | | |
| | | o  25:143c7b322e99
| | | |
| | o |  24:df7b2a4fef82
| | | |
| | o |  23:172fa7f90762
| | | |
| o | |  22:b3d5021c7a87
| | | |
| o | |  21:ed2db86d22f3
|/ / /
o | |  20:ea4430bb185c
| | |
o | |    19:be8ce4d1677a
|\ \ \
| | o |  18:4336d3ae03f4
| | | |
| o | |  17:4e5c9d009b4f
| | | |
| | | o  16:0b623f82f061
| | | |
| o | |  15:42b0735c6d0f
| | | |
| | o |  14:f8c7d8f6cce7
| | | |
+-----o  13:0a111280b48c
| | |
o | |  12:66be98df7511
|/ /
| o  11:a6bcbe4349a7
| |
o |  10:b3f389e87e85
| |
o |  9:7cad8c27ce75
| |
o |  8:d5aa81aff229
| |
| o  7:f15e39620f18
| |
o |  6:62d5cd71b88b
| |
| o  5:1e8da8d68453
| |
| o  4:2fd2b2149b79
|/
o  3:bbc1fa9cd27b
|
o  2:6899436d6d58
|
o  1:15127f0cb1bd
|
o  0:a9675afd847b
"""

Note how 75 and 79 are both ancestors of tip. Two separate runs "hg
strip 79 ; hg strip 75" work just fine; it's only when combining them
into a single run that it crashes.

Finally, here is the changeset that introduced the crash:

changeset:   15763:9df9444e96ec
user:        Pierre-Yves David <pierre-yves.david at ens-lyon.org>
date:        2011-11-28 01:18:15 +0100
summary:     addchangegroup: use a postrelease callback to call changegroup hook

Anyways, from those bits and pieces I have a pretty good idea of what
the bug is, a very vague idea about how to fix it, and no idea at all
about how to reproduce it with a *small* test case.

Any tips?

Thanks --

Greg

P.S. oh yeah, there's nothing secret or proprietary in the test repo
that found this, so I can share it with anyone who asks.


More information about the Mercurial-devel mailing list