Page MenuHomePhabricator

Gerrit-patch-uploader fails under git 1.9
Closed, ResolvedPublic


Upload failed with the following error message:

git push origin HEAD:refs/for/master
error: invalid protocol: wanted 'old new ref'
fatal: internal server error
fatal: The remote end hung up unexpectedly
error: pack-objects died of signal 13
error: failed to push some refs to 'ssh://gerrit/mediawiki/extensions/WikiEditor'
Upload failed
Reason: Push failed (check log above for details)

This seems to be an incompatibility between Git 1.9 and Gerrit's git implementation.

Event Timeline

Fomafix created this task.Jan 9 2015, 2:47 PM
Fomafix raised the priority of this task from to Needs Triage.
Fomafix updated the task description. (Show Details)
Fomafix added a subscriber: Fomafix.
valhallasw added a subscriber: valhallasw.EditedJan 9 2015, 2:50 PM suggests this is a Git 1.7 (which is included in Ubuntu 12.04, which is what we run on normal webgrid nodes) vs 1.9 (Ubuntu 14.04, which is what we run on the uWSGI node) issue. Reverting back to fcgi for now.

Can you check whether that fixes the issue?

Fomafix closed this task as Resolved.Jan 9 2015, 2:59 PM
Fomafix claimed this task.

Now it works again.

I compiled a version of git for trusty that's (same as precise), and it is in ~/git/bin in g-p-u.

tools.gerrit-patch-uploader@tools-trusty:~/git$ ./bin/git --version
git version
tools.gerrit-patch-uploader@tools-trusty:~/git$ git --version
git version 1.9.1
valhallasw renamed this task from Push failed to Gerrit-patch-uploader fails under git 1.9.Jan 9 2015, 3:11 PM
valhallasw reopened this task as Open.
valhallasw removed Fomafix as the assignee of this task.
valhallasw triaged this task as Normal priority.
valhallasw updated the task description. (Show Details)
valhallasw added a project: Gerrit.
valhallasw set Security to None.
valhallasw added subscribers: QChris, demon.EditedJan 9 2015, 8:58 PM

This is an issue with JGit, and has been solved:

@chad / @QChris, would it be possible to upgrade Gerrit's JGit to 3.5+, to support shallow pushes with Git 1.9+?

I encountered a similar problem on Mac. I didn't check the git versions at the time, but I suspect it might be the same.

The git version that ships with OS X "Command line tools" is v1.9.3. After installing git through Homebrew (which installs latest stable, v2.2.1) it worked fine.

It might also be related to shallow git clones (e.g. -- depth 1), which somehow makes it impossible to submit changes to Gerrit for review. After re-cloning (or git fetch --unshallow), submission worked.

Yep, it's related to shallow clones; git 1.7 can push from shallow clones in some cases (including a fresh clone, which is what g-p-u does), and git 1.9 can always push from shallow clones if the server supports it. JGit 3.5+ does, but our Gerrit instance runs on an older version. I don't want to use non-shallow clones, as that would make the patch submission significantly slower.

demon added a comment.Jul 25 2016, 3:51 PM

Is this fixed with new gerrit?

demon moved this task from Bugs & stuff to Maybe fixed? on the Gerrit board.Jul 25 2016, 5:23 PM
Krinkle removed a subscriber: Krinkle.Jul 25 2016, 6:27 PM

Question is which JGit version our Gerrit instance runs on. If it's 3.5+ this bug is fixed, AFAIU.

demon closed this task as Resolved.Jul 26 2016, 2:57 PM
demon claimed this task.

We're running I'm assuming this is solved based on what @valhallasw said, but it'd be nice if someone could confirm the actual tool works again :)

bam80 reopened this task as Open.Mon, Aug 12, 2:43 PM
bam80 added a subscriber: bam80.EditedMon, Aug 12, 2:46 PM

Hi. I'm reopening this since I tried latest Gerrit 3.0.1 and the problem still there.
Pushing from shallow clone to a new Gerrit project:

$ git push
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 325 bytes | 325.00 KiB/s, done.
Total 4 (delta 1), reused 2 (delta 0)
remote: Resolving deltas: 100% (1/1)
error: remote unpack failed: error Missing commit b498feadb1c3a0d7904d316ef923516b0f16a95c
To https://gerrit/a/test
 ! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs

push into the Gerrit repo directly with git util (using e.g. ssh:// access)

I'm a bit confused -- are you trying to use Gerrit Patch Uploader and/or Wikimedia's Gerrit, or just testing something locally?

As for pushing from a shallow clone to an empty remote: I'm not too surprised this doesn't work. The empty remote doesn't know it's supposed to be a shallow repo, and your local repository doesn't have all the commits needed to initialize a non-shallow repo. So to make it work you have to initialize Gerrit from a non-shallow repo, and then add it as a remote to your shallow clone. (it _might_ be possible to initialize a shallow copy _on gerrit_ as well, but that would surprise me as I don't see a clear use case for that).

bam80 added a comment.EditedTue, Aug 13, 8:13 PM

@valhallasw, I'm testing locally.
About pushing from shallow clone - it works perfectly with git util, just set receive.shallowupdate option for a new repo:

PS: that option is not supported by JGit, that is why I have to use native git util for pushing to actual Gerrit repo directory on server side
PPS: use case is simple - not to host 60Gb of Android project on Gerrit, but only few Gb instead..
PPPS: after pushing with git util, JGit works with that shallow repo flawlessly (and Gerrit too)

valhallasw closed this task as Resolved.Wed, Aug 14, 7:10 PM

Ok, then I'm going to close this ticket as this seems unrelated.