Bug 3429 - abort: 00changelog.i@b0933213c7e6: no node! in pretxnchangegroup
Summary: abort: 00changelog.i@b0933213c7e6: no node! in pretxnchangegroup
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: urgent bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-07 02:53 UTC by Aaron Digulla
Modified: 2012-07-17 13:06 UTC (History)
9 users (show)

See Also:
Python Version: ---


Attachments
(34 bytes, text/plain)
2012-05-08 22:56 UTC, Ivan Perdomo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Digulla 2012-05-07 02:53 UTC
When trying to push to a repo that is protected with a pretxnchangegroup 
hook, I get this error:

abort: 00changelog.i@b0933213c7e6: no node!

The script tries to run "hg log -r 
bd559fee8e674321d046f8fbde845944ac7958bc:tip"

When I run "hg debugknown" with the two node IDs, I get "11" in my local 
repo and "00" for the remote repo.

For me, this looks as if the hook is run "outside" the transaction (i.e. at 
a time when the nodes are not yet added to the remote repo).

A colleague of mine has the same problem.

Server is running 2.2.1, I'm running 2.2.1. My colleague is running 1.8.4.
Comment 1 Martin Geisler 2012-05-07 05:04 UTC
Hi Aaron,

Can you show us the full script?

You're correct that a pretxnchangegoup hook is run before the changesets are
run before the transaction is complete. However, it can see the pending
changesets. This is implemented by setting a HG_PENDING environment variable
when executing the hook: if the hook runs "hg", then that process will see
HG_PENDING and read a special pending changelog file. Other "hg" processes
wont see HG_PENDING and wont read the pending changelog.

So in other words: if you happen to clear the environment in your hook, then
you will break this mechanism and the hook will no longer see the pending
changeset.
Comment 2 Martin Geisler 2012-05-07 05:05 UTC
Also, I should ask: where does bd559fee8e674321d046f8fbde845944ac7958bc come
from? Is it $HG_NODE?
Comment 3 Aaron Digulla 2012-05-07 05:42 UTC
1. The variable HG_PENDING is set and contains the path to the repo into 
which I'm trying to push.

2. The relevant part of the script looks like so:

hg log -r "$HG_NODE:tip" --template "{author}\n"

No environment variables are cleared/modified in the script.

"bd559fee8e674321d046f8fbde845944ac7958bc" is the ID the first changeset. As 
you assumed, it gets passed via $HG_NODE.
Comment 4 TakayukiKondo 2012-05-07 07:49 UTC
Hi! 
I also found same bug and I wrote full script 
to reproduce the problem completely.

https://gist.github.com/2627033
Comment 5 Martin Geisler 2012-05-07 08:13 UTC
Turning the bat file into an equivalent shell script:

  cd /tmp
  rm -rf repo clone
  hg init repo
  cd repo

  echo "hg heads" > .hg/heads.sh
  chmod +x .hg/heads.sh
  echo "[hooks]" > .hg/hgrc
  echo "pretxnchangegroup.heads = .hg/heads.sh" >> .hg/hgrc

  echo "a" > a
  hg commit -Am "added a"
  echo "b" > b
  hg commit -Am "added b"

  hg clone . ../clone
  cd ../clone

  hg update 0
  echo "1" > 1
  hg commit -Am "added 1"

  hg push -f

let's 'hg bisect' reveal that the first bad revision is

  changeset:   16418:e5750c6716eb
  user:        Matt Mackall <mpm@selenic.com>
  date:        Fri Apr 13 21:35:48 2012 -0500
  summary:     revlog: increase readahead size
Comment 6 Matt Mackall 2012-05-07 11:29 UTC
..a change that was backed out here:

changeset:   16533:95698ee29181
branch:      stable
user:        Matt Mackall <mpm@selenic.com>
date:        Fri Apr 27 13:07:29 2012 -0500
summary:     revlog: backout e5750c6716eb

..so there was never a release that contained this change. Nor is it a very
plausible candidate for causing anything other than performance changes.
Comment 7 Matt Mackall 2012-05-07 12:05 UTC
mg's script doesn't fail for me.
Comment 8 Matt Mackall 2012-05-07 12:06 UTC
What do we know about the node in the title?
Comment 9 Aaron Digulla 2012-05-07 12:10 UTC
It's an arbitrary changeset in the push. In my case, it was the last node but 
for a colleague, it was a node in the middle of the changegroup.

Any command that I could run? For example a command that validates the 
structure of the repo or something?
Comment 10 Ivan Perdomo 2012-05-07 14:31 UTC
Perhaps is obvious but this issue happens also in the pretxncommit 

Steps to reproduce:
hg clone https://bitbucket.org/iperdomo/issue3428

# add [hooks] to the .hg/hgrc
# [hooks]
# pretxncommit = ./script/jscheck-hg

echo "debugger;" >> test.js
hg ci -m 'Dummy test'
Performing jslint check on modified js resources
abort: 00changelog.i@99c44b4e1569: no node!
Comment 11 Matt Mackall 2012-05-08 14:39 UTC
Ok, well I'm still at a loss as to how to hit this issue. Martin, can you
check your bisect again?
Comment 12 Matt Mackall 2012-05-08 14:39 UTC
Also, can someone try adding --traceback to the command raising the abort?
Comment 13 Ivan Perdomo 2012-05-08 15:08 UTC
I just made a simple commit and adding --traceback doesn't show any error
stack trace.

# Note 1: I'm using the repo mentioned in msg19935

hg --traceback commit -m 'Dummy commit 2'
Performing jslint check on modified js resources
abort: 00changelog.i@cc05fe7e0ffd: no node!

# Note 2: The commit gets done

hg log -l1 
changeset:   3:cc05fe7e0ffd
tag:         tip
user:        Iván Perdomo <ivan.perdomo@openbravo.com>
date:        Tue May 08 22:57:23 2012 +0200
summary:     Dummy commit 2
Comment 14 Matt Mackall 2012-05-08 15:12 UTC
Presumably the error message comes from an hg command run in a hook, so
that's where --traceback needs to be.
Comment 15 Ivan Perdomo 2012-05-08 22:56 UTC
Attached you'll find traceback from to the 'hg log' call inside the hook
Comment 16 Martin Geisler 2012-05-09 01:25 UTC
I retried the bisect, this time with a 'make local' as part of the bisect
command. It now points to:

  changeset:   16414:e8d37b78acfb
  user:        Bryan O'Sullivan <bryano@fb.com>
  date:        Thu Apr 12 14:05:59 2012 -0700
  summary:     parsers: use base-16 trie for faster node->rev mapping

This script is enough to provoke the error:

  rm -rf /tmp/{repo,clone}
  hg init /tmp/repo
  cd /tmp/repo
  echo "[hooks]" > .hg/hgrc
  echo "pretxnchangegroup = hg heads" >> .hg/hgrc
  echo "a" > a
  hg commit -Am "a"
  hg clone . ../clone
  cd ../clone
  echo "aa" > a
  hg commit -m "aa"
  hg push
Comment 17 Matt Mackall 2012-05-09 09:47 UTC
Confirmed. Regression -> raising to urgent.
Comment 19 Bugzilla 2012-05-12 09:31 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:31 EDT  ---

This bug was previously known as _bug_ 3428 at http://mercurial.selenic.com/bts/issue3428
Imported an attachment (id=1661)

Bug Status was UNCONFIRMED but everconfirmed was true
   Setting status to CONFIRMED

Comment 20 Matt Mackall 2012-05-13 04:23 UTC
Fixed by:

http://www.selenic.com/hg/rev/e6dfbc5df76f
Comment 21 Aaron Digulla 2012-07-04 06:10 UTC
(In reply to comment #20)

Is this fix included in version 2.2.2?
Comment 22 Mark Drago 2012-07-04 07:30 UTC
(In reply to comment #21)

Yes.  It is mentioned in the changelog here:
http://mercurial.selenic.com/wiki/WhatsNew#Mercurial_2.2.2_.282012-06-01.29

I can also verify that I experienced the issue with 2.2.1 and no longer experience it with 2.2.2.

Mark.
Comment 23 Aaron Digulla 2012-07-17 05:52 UTC
All of our developers have upgraded to release 2.2.3 one week ago and we didn't have any issues since.

From our side, the bug can be closed.