Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » [SEMISOLVED] Missing tree/blob, Gerrit and EMF
[SEMISOLVED] Missing tree/blob, Gerrit and EMF [message #1646055] Mon, 02 March 2015 20:50 Go to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
I've ran into a problem that seems to be a weird interaction between EGit, Gerrit and EMF:

I have a Gerrit repository that contains some EMF models and after a fresh clone of the repository and performing a very simple modification to the EMF .genmodel file I get a "Missing blob" error when attempting to "Push to Gerritt...".

The precise steps are these:

1. In the Git repositories view, I clone the repository which contains only some EMF projects.
2. Under the new cloned repo, I select "Remotes->origin" and do "right-click->Gerrit configuration". Check the values, and click OK.
3. Under "Local" I select the master branch, do "right-click->Configure branch" and select "Rebase"
4. I open the model's ecore file (mymodel.ecore) and make one modification, which is to remove a reference to an element in another EMF project ("othermodel"), within the same repository. Then I save.
5. I open the model's genmodel file (mymodel.genmodel), and reload the ecore model, removing the reference to the other model. The change is saved automatically.
6. I go to the EGit staging view, and add "mymodel.ecore" and "mymodel.genmodel" to the index, Click the "Add Change-Id" button, write a commit message and click "Commit".
7. I right-click on the repository and then "Push to Gerrit".

That's when the push fails with the "Missing tree/blob" error.

The error ocurrs exactly when I modify the genmodel file. I tried modifying only the ecore file and there is no problem, so the problem is with the genmodel modification.

After trying "git prune" on the command-line I was able to push the change to Gerrit, but I'm wondering a couple of things:

1) is "git prune" safe for this scenario?
2) why did this happen in the first place? why does modifying the genmodel file create a missing blob?
3) is this a problem with EGit, Gerrit or EMF? (I'm positing it here in case it's an EGit issue)
4) any ideas about how to avoid this in the future?
5) is this a bug or is this behaviour expected? (seems like a bug)

I'm using

Eclipse Modeling Tools

Version: Mars Milestone 5 (4.5.0M5)
Build id: 20150205-1617

on Mac OS X Yosemite

With

Eclipse Git Team Provider 3.7.0.201502031740-rc1 org.eclipse.egit.feature.group Eclipse EGit

and

EMF - Eclipse Modeling Framework SDK 2.11.0.v20150123-0357 org.eclipse.emf.sdk.feature.group Eclipse Modeling Project

Thanks

[Updated on: Wed, 04 March 2015 20:38]

Report message to a moderator

Re: Missing tree/blob, Gerrit and EMF [message #1646769 is a reply to message #1646055] Tue, 03 March 2015 05:11 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Ernesto,

Certainly I've never seen this problem nor have I ever heard of anyone
else with this problem. There are a great many projects with EMF models
using EGit so it must be something special in your situation. I know
that team providers make a distinction between text files (that require
line ending conversion) and binary files (that must be byte-for-byte
preserved as is), so maybe there is some issue related to having
committed a binary representation and then trying to commit a textual
representation. The Window -> Preferences... -> Team -> File Content
does list *.genmodel as ASCII Text for me so it's just a thought. No
doubt the EGit folks will have a better idea of what might cause the
problem you describe...


On 02/03/2015 9:50 PM, Ernesto Posse wrote:
> I've ran into a problem that seems to be a weird interaction between
> EGit, Gerrit and EMF:
>
> I have a Gerrit repository that contains some EMF models and after a
> fresh clone of the repository and performing a very simple
> modification to the EMF .genmodel file I get a "Missing blob" error
> when attempting to "Push to Gerritt...".
>
> The precise steps are these:
>
> 1. In the Git repositories view, I clone the repository which contains
> only some EMF projects.
> 2. Under the new cloned repo, I select "Remotes->origin" and do
> "right-click->Gerrit configuration". Check the values, and click OK.
> 3. Under "Local" I select the master branch, do
> "right-click->Configure branch" and select "Rebase"
> 4. I open the model's ecore file (mymodel.ecore) and make one
> modification, which is to remove a reference to an element in another
> EMF project ("othermodel"), within the same repository. Then I save.
> 5. I open the model's genmodel file (mymodel.genmodel), and reload the
> ecore model, removing the reference to the other model. The change is
> saved automatically.
> 6. I go to the EGit staging view, and add "mymodel.ecore" and
> "mymodel.genmodel" to the index, Click the "Add Change-Id" button,
> write a commit message and click "Commit".
> 7. I right-click on the repository and then "Push to Gerrit".
>
> That's when the push fails with the "Missing tree/blob" error.
>
> The error ocurrs exactly when I modify the genmodel file. I tried
> modifying only the ecore file and there is no problem, so the problem
> is with the genmodel modification.
>
> After trying "git prune" on the command-line I was able to push the
> change to Gerrit, but I'm wondering a couple of things:
>
> 1) is "git prune" safe for this scenario?
> 2) why did this happen in the first place? why does modifying the
> genmodel file create a missing blob?
> 3) is this a problem with EGit, Gerrit or EMF? (I'm positing it here
> in case it's an EGit issue)
> 4) any ideas about how to avoid this in the future?
> 5) is this a bug or is this behaviour expected? (seems like a bug)
>
> I'm using
>
> Eclipse Modeling Tools
>
> Version: Mars Milestone 5 (4.5.0M5)
> Build id: 20150205-1617
>
> on Mac OS X Yosemite
>
> With
> Eclipse Git Team Provider 3.7.0.201502031740-rc1
> org.eclipse.egit.feature.group Eclipse EGit
>
> and
>
> EMF - Eclipse Modeling Framework SDK 2.11.0.v20150123-0357
> org.eclipse.emf.sdk.feature.group Eclipse Modeling Project
>
> Thanks
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Missing tree/blob, Gerrit and EMF [message #1647739 is a reply to message #1646055] Tue, 03 March 2015 15:38 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
Thanks Ed. I checked my "Preferences...->Team->File Contents" and both *.ecore and *.genmodel are listed as ASCII Text.

I've investigated a bit further and I'm still no close to understanding what's going on.

When I reclone the remote repository I check its integrity with "git fsck" and everything is OK.

[-bash|epp@slartibartfast:xtumlrt.model] > git fsck
Checking object directories: 100% (256/256), done.
Checking objects: 100% (804/804), done.


Furthermore, I look for the blob which is problematic and it is found:

[-bash|epp@slartibartfast:xtumlrt.model] > git ls-tree -r e853a03e95f870a896bd67be7b8a5dce70559bc4
100644 blob a1ed6680bae1cb088100b9f4a31501e6bc25af6b	MANIFEST.MF


So here's the first mystery: if the blob is there, why if EGit/Gerrit not sending it in the next "Push to Gerrit" if the only thing modified is the relevant .genmodel? How can modifying the .genmodel remove this blob?

If I look into that blob itself, I find out which MANIFEST.MF file it's pointing to:

[-bash|epp@slartibartfast:xtumlrt.model] > git cat-file -p a1ed6680bae1cb088100b9f4a31501e6bc25af6b
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: com.zeligsoft.xtumlrt.common.model;singleton:=true
Bundle-Version: 0.4.0.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: com.zeligsoft.xtumlrt.common,
 com.zeligsoft.xtumlrt.common.impl,
 com.zeligsoft.xtumlrt.common.util
Require-Bundle: org.eclipse.core.runtime,
 org.eclipse.emf.ecore;visibility:=reexport
Bundle-ActivationPolicy: lazy


and the thing to notice here is the "Require-Bundle:" field, because that same file looks like follows in the actual file in the freshly cloned repository:

[-bash|epp@slartibartfast:META-INF] > cat MANIFEST.MF 
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: com.zeligsoft.xtumlrt.common.model;singleton:=true
Bundle-Version: 0.4.0.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: com.zeligsoft.xtumlrt.common,
 com.zeligsoft.xtumlrt.common.impl,
 com.zeligsoft.xtumlrt.common.util
Require-Bundle: org.eclipse.core.runtime,
 org.eclipse.emf.ecore;visibility:=reexport,
 com.zeligsoft.xtumlrt.transformation.model;bundle-version="0.1.0";visibility:=reexport
Bundle-ActivationPolicy: lazy


The difference is that the one on the repository includes the reference to the other project.

So somehow, the problematic blob contains the version of MANIFEST.MF which has the reference already removed! How is that possible?


Re: Missing tree/blob, Gerrit and EMF [message #1647777 is a reply to message #1647739] Tue, 03 March 2015 16:00 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
And a new development: it looks like editing the ecore file by removing the reference to the other project removes the blob in question!
Re: Missing tree/blob, Gerrit and EMF [message #1648448 is a reply to message #1647777] Tue, 03 March 2015 23:14 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
And yet more on this:

it seems that the problem actually is due to an ammend. It only happens when I ammend a commit.
.
[SEMISOLVED] Re: Missing tree/blob, Gerrit and EMF [message #1650419 is a reply to message #1648448] Wed, 04 March 2015 20:37 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
Apparently the problem is due to a mismatch in the JGit version in the client and the server.

In my case the solution was to downgrade JGit to a pre-3.5, more specifically 3.4.2, as I don't control the (Gerrit) server, which has a much older version (3.2).

The problem, I can confirm, occurs whenever the file in question is an EMF file either an ecore or genmodel file (no problem with other files, go figure). And it happens when one tries to push to gerrit (not bypassing review) *after* amending the last commit.

An alternative solution is to do the following on the command-line

git reflog expire --expire=now --all
git gc --agressive --prune=now

... immediately after an amend and before pushing to gerrit. This is of course extremely inconvenient, so I prefer to just downgrade JGit.

I've marked it as [SEMISOLVED] because even though I got the solutions, I don't have the reasons. I still do not know what triggered the problem. There is a thread on the egit-dev mailing list on it which suggests the problem happens when an object has a reference to another object which is no longer in the repo, but I don't understand how that applies to this particular situation. The blobs marked as missing exist in the repository (both remote and local) before the edit and the amend. How is it that editing an EMF file and amending the commit cause these blobs to disappear?



Re: [SEMISOLVED] Re: Missing tree/blob, Gerrit and EMF [message #1654123 is a reply to message #1650419] Fri, 06 March 2015 14:47 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
We did a couple of fixes in JGit in the last releases to address such problems,
if you are using a recent EGit and Gerrit version which are using a recent JGit those
fixes should help.
Previous Topic:What part of updates do I need to install?
Next Topic:# WARNING: head commit changed in the meantime
Goto Forum:
  


Current Time: Thu Mar 28 15:40:28 GMT 2024

Powered by FUDForum. Page generated in 0.03687 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top