CandyShop / gerrit

Automatically exported from code.google.com/p/gerrit
Apache License 2.0
1 stars 0 forks source link

Nested Submodule Subscriptions Don't Update #1491

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Affected Version:

2.4-rc0

What steps will reproduce the problem?

1) Create three repositories in Gerrit: A, B, and C.
2) Clone A, add B as a submodule. Include the "branch = master" line in 
.gitmodules to configure a Gerrit Submodule Subscription.
3) Clone B, add C as a submodule. Include the "branch = master" line in 
.gitmodules to configure a Gerrit Submodule Subscription.
4) Create and submit a change to the master branch of C.

What is the expected output? What do you see instead?

Expected:

The submodule subscription for repository B activates, creating a new commit 
that updates the submodule pointer from B to C. The submodule subscription for 
A then activates, creating a new commit that updates the submodule pointer from 
A to B.

Observed:

The submodule subscription for repository B operates correctly. The submodule 
subscription for repository A, however, fails with a stack trace like the 
following:

[2012-07-25 03:01:17,063] ERROR com.google.gerrit.server.git.SubmoduleOp : 
Cannot update gitlinks for refs/heads/master
org.eclipse.jgit.errors.MissingObjectException: Missing unknown 
15f7e3e02a2772f4e1b13f8e25224b6eff5751d5
        at org.eclipse.jgit.storage.file.WindowCursor.open(WindowCursor.java:125)
        at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:228)
        at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:811)
        at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:724)
        at com.google.gerrit.server.git.SubmoduleOp.updateGitlinks(SubmoduleOp.java:265)
        at com.google.gerrit.server.git.SubmoduleOp.updateSuperProjects(SubmoduleOp.java:239)
        at com.google.gerrit.server.git.SubmoduleOp.updateGitlinks(SubmoduleOp.java:344)
        at com.google.gerrit.server.git.SubmoduleOp.updateSuperProjects(SubmoduleOp.java:239)
        at com.google.gerrit.server.git.SubmoduleOp.update(SubmoduleOp.java:121)
        at com.google.gerrit.server.git.MergeOp.updateSubscriptions(MergeOp.java:1135)
        at com.google.gerrit.server.git.MergeOp.merge(MergeOp.java:280)
        at com.google.gerrit.server.git.ChangeMergeQueue.mergeImpl(ChangeMergeQueue.java:181)
        at com.google.gerrit.server.git.ChangeMergeQueue.merge(ChangeMergeQueue.java:101)
        at com.google.gerrit.server.changedetail.Submit.call(Submit.java:184)
        at com.google.gerrit.httpd.rpc.changedetail.SubmitAction.call(SubmitAction.java:54)
        at com.google.gerrit.httpd.rpc.changedetail.SubmitAction.call(SubmitAction.java:30)
        at com.google.gerrit.httpd.rpc.Handler.to(Handler.java:65)
        at com.google.gerrit.httpd.rpc.changedetail.ChangeManageServiceImpl.submit(ChangeManageServiceImpl.java:52)
        at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.google.gwtjsonrpc.server.MethodHandle.invoke(MethodHandle.java:91)
        at com.google.gwtjsonrpc.server.JsonServlet.doService(JsonServlet.java:379)
        at com.google.gwtjsonrpc.server.JsonServlet.service(JsonServlet.java:265)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
        at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)
        at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
        at com.google.gerrit.pgm.http.jetty.GetUserFilter.doFilter(GetUserFilter.java:76)
        at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
        at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
        at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
        at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
        at com.google.gwtexpui.server.CacheControlFilter.doFilter(CacheControlFilter.java:76)
        at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
        at com.google.gerrit.httpd.RequireSslFilter.doFilter(RequireSslFilter.java:68)
        at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
        at com.google.gerrit.httpd.RequestCleanupFilter.doFilter(RequestCleanupFilter.java:54)
        at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
        at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
        at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
        at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
        at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1322)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:473)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:921)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:403)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:856)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114)
        at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:59)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114)
        at org.eclipse.jetty.server.Server.handle(Server.java:352)
        at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:596)
        at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1069)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:805)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218)
        at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:426)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:510)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450)
        at java.lang.Thread.run(Thread.java:662)
[2012-07-25 03:01:17,065] ERROR com.google.gerrit.server.git.MergeOp : The 
gitLinks were not updated according to the subscriptions Cannot update gitlinks 
for refs/heads/master

Original issue reported on code.google.com by jt...@evernote.com on 25 Jul 2012 at 5:14

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I have found the reason of this problem.
Let's say A uses B as a submodule, and B uses C as its submodule.
When we push something to C, the first updateSuperProjects() adds information
about the change in C into B repository.
updateGitlinks() uses RevWalker "rw" to find the matching commit
and it is operating on repo C. When the nested updateSuperProjects()
is called, it is supposed to modify repo A with the information about
change in repo B. However, updateGitlinks() still uses the same RevWalker
that searches repo C looking for a change that was made in repo B.
And it, obviously, fails...

I have created a patch for 2.4.2, and for master branch.
I tested 2.4.2 one but not the master one. However,
the code is very similar.

I have absolutely no experience with Gerrit sources, so this
change may not be 100% correct. But at least it works :)

Original comment by sjakub on 17 Oct 2012 at 1:02

Attachments:

GoogleCodeExporter commented 9 years ago
Actually the this problem affects not only nested repositories... Because the 
exception stops processing subscribers, other repositories that directly use
the repository that got changed and happen to be processed after nested one,
won't get modified...

Original comment by sjakub on 17 Oct 2012 at 5:29

GoogleCodeExporter commented 9 years ago
Thanks for looking into how to fix this. Would you be able to push the fix to 
the Gerrit project on [1] for code review?
We can only accept fixes from contributors that have a valid contributor 
agreement, see [2] for details.

[1] https://gerrit-review.googlesource.com
[2] https://gerrit-review.googlesource.com/Documentation/dev-contributing.html

Original comment by edwin.ke...@gmail.com on 17 Oct 2012 at 5:38

GoogleCodeExporter commented 9 years ago
It's submitted (https://gerrit-review.googlesource.com/#/c/38520/).
I submitted it to master, should I do the same with stable-2.4 (and possibly 
stable-2.5)?
I'm not sure what the procedure is...

Original comment by sjakub on 17 Oct 2012 at 5:35

GoogleCodeExporter commented 9 years ago
No need to upload it for stable-2.4. At the moment there is no stable bug-fix 
release planned for 2.4 (not sure if there will be any).

Gerrit 2.5 is just about to be released (rc1 was published today). Only 
critical bugs can still be fixed there. If your change gets accepted for master 
I might cherry-pick it to 2.5 if this fix is important for you.

Original comment by edwin.ke...@gmail.com on 17 Oct 2012 at 5:47

GoogleCodeExporter commented 9 years ago
Got it. Thanks for the fast response. 2.5 would be great! :)

Original comment by sjakub on 17 Oct 2012 at 6:08

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
We would also love to see this fixed in 2.5

Original comment by jt...@evernote.com on 17 Oct 2012 at 6:10

GoogleCodeExporter commented 9 years ago
I've cherry-picked it for 2.5.

Original comment by edwin.ke...@gmail.com on 18 Oct 2012 at 10:37

GoogleCodeExporter commented 9 years ago
Thanks! :)

Original comment by sjakub on 18 Oct 2012 at 4:32

GoogleCodeExporter commented 9 years ago
Issue 1628 has been merged into this issue.

Original comment by bklarson@gmail.com on 25 Oct 2012 at 9:07

GoogleCodeExporter commented 9 years ago

Original comment by edwin.ke...@gmail.com on 31 Oct 2012 at 8:46