My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 80: Push over SSH to refs/heads/$branch gives "invalid old id sent" error message
  Back to list
Status:  Released
Owner:  code-rev...@gtempaccount.com
Closed:  Oct 2012


Sign in to add a comment
 
Reported by code-rev...@gtempaccount.com, Sep 24, 2009
Reported by Arve Hjønnevåg <arve@android.com> on Tue Feb 17 19:41:07 PST 2009
Source: JIRA GERRIT-80
Affected Version: 2.0.4

$ git ssh://review.source.android.com:29418/kernel/msm.git android-
msm-2.6.27:refs/heads/android-msm-2.6.27
Counting objects: 14, done.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 1.02 KiB, done.
Total 8 (delta 6), reused 0 (delta 0)
To ssh://review.source.android.com:29418/kernel/msm.git
 ! [remote rejected] android-msm-2.6.27 -> android-msm-2.6.27 (invalid old id
sent)
error: failed to push some refs to 'ssh://review.source.android.com:29418/
kernel/msm.git'
Sep 24, 2009
#1 code-rev...@gtempaccount.com
Comment by Shawn Pearce <sop@google.com> on Tue Feb 17 19:46:04 PST 2009

Turns out this is due to a bug in JGit.

To reproduce the scenario:

- Submit a change on the web, using the Submit Patch Set button.
- Immediately push directly into the same branch, using SSH.

Its important that the push comes very quickly after the web submit, as the
bug is caused by an invalid cached state in Gerrit.  If the Repository object
is evicted from the RepositoryCache, or if the destination branch is updated
on disk externally from Gerrit, or if Gerrit is restarted between the two
steps, the bug isn't reproduced.

It turns out MergeOp (aka submit change on web) inside Gerrit is caching a
CodeReviewCommit inside of the RefDatabase of the JGit Repository instance.
This is a subclass of RevCommit, which is itself a subclass of ObjectId.
RevCommit overrides equals(Object) to perform identity equality rather than
the semantic equality of the base ObjectId class.  Later during the SSH push
the daemon tries to use the CodeReviewCommit.equals() to test semantic
identity, but is getting object identity, and the instances are two different
instances.

I sent a patch upstream to JGit to work around this:

  http://thread.gmane.org/gmane.comp.version-control.git/110501
Sep 24, 2009
#2 code-rev...@gtempaccount.com
Update by Shawn Pearce <sop@google.com> on Tue Feb 17 19:50:29 PST 2009
Labels: Component-JGit
Sep 24, 2009
#3 code-rev...@gtempaccount.com
Comment by Shawn Pearce <sop@google.com> on Wed Feb 18 14:52:40 PST 2009

Committed upstream in JGit as 4af1edad36e729ee846ba5e943949b19fc39e744.
Will be included in Gerrit 2.0.4.
Sep 24, 2009
#4 code-rev...@gtempaccount.com
Update by Shawn Pearce <sop@google.com> on Wed Feb 18 14:52:40 PST 2009

Fixed in version 2.0.4.
Status: Fixed
Sep 25, 2009
#5 code-rev...@gtempaccount.com
(No comment was entered for this change.)
Labels: FixedIn-2.0.4
Oct 25, 2012
#6 sop@google.com
(No comment was entered for this change.)
Status: Released
Sign in to add a comment

Powered by Google Project Hosting