New issue
Advanced search Search tips
Starred by 5 users

Issue metadata

Status: Released
Owner:
Closed: Jul 2018
Cc:
Components:



Sign in to add a comment
link

Issue 9153: IllegalStateException: Duplicate stages not allowed -from query involving changes with special characters

Reported by bassem.r...@gmail.com, Jun 4 2018 Project Member

Issue description

*****************************************************************
*****                                                       *****
***** !!!! THIS BUG TRACKER IS FOR GERRIT CODE REVIEW !!!!  *****
*****                                                       *****
***** DO NOT SUBMIT BUGS FOR CHROME, ANDROID, CYANOGENMOD,  *****
***** INTERNAL ISSUES WITH YOUR COMPANY'S GERRIT SETUP, ETC.*****
*****                                                       *****
*****   THOSE ISSUES BELONG IN DIFFERENT ISSUE TRACKERS     *****
*****                                                       *****
*****************************************************************

Affected Version:
2.14.8

What steps will reproduce the problem?

1. Have changes with UTF-8 filenames, most specifically two consecutive paths that are identical except for their special characters/sub-string part;
e.g., our case:
[...]
"a/b/SíÒr-Norge.map",
"a/b/Sør-Norge.map",
[...]
(above, the few characters right after the capital 'S' are the differing and special ones).

2. Run a query command expected to involve such changes;
in our case, a query as simple as this one does it:
ssh -p 29418 localhost gerrit query --current-patch-set branch:dev OR branch:master

What is the expected output?
Changes returned without an error ending the command; the latter to end successfully.

What do you see instead?
The below stack-trace in error_log, which ends the command prematurely.

Please provide any additional information below.
=>
Debugging shows jgit throwing this upon encountering the second path shown above, right after considering the first one. Either jgit in there or gerrit upstream does not properly decode such characters, leading to this duplicated stages/path verdict. IOW, such two paths might wrongfully get their few special characters considered as identical.

com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalStateException: Duplicate stages not allowed: 0 a/b/S�r-Norge.map
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2218)
        at com.google.common.cache.LocalCache.get(LocalCache.java:4147)
        at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:5053)
        at com.google.gerrit.server.cache.h2.H2CacheImpl.get(H2CacheImpl.java:134)
        at com.google.gerrit.server.patch.PatchListCacheImpl.get(PatchListCacheImpl.java:101)
        at com.google.gerrit.server.patch.PatchListCacheImpl.get(PatchListCacheImpl.java:137)
        at com.google.gerrit.server.patch.PatchListCacheImpl.get(PatchListCacheImpl.java:117)
        at com.google.gerrit.server.events.EventFactory.asPatchSetAttribute(EventFactory.java:492)
        at com.google.gerrit.server.query.change.OutputStreamQuery.buildChangeAttribute(OutputStreamQuery.java:282)
        at com.google.gerrit.server.query.change.OutputStreamQuery.query(OutputStreamQuery.java:197)
        at com.google.gerrit.sshd.commands.Query.run(Query.java:106)
        at com.google.gerrit.sshd.SshCommand$1.run(SshCommand.java:35)
        at com.google.gerrit.sshd.BaseCommand$TaskThunk.run(BaseCommand.java:453)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:511)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Duplicate stages not allowed: 0 a/b/S�r-Norge.map
        at org.eclipse.jgit.dircache.DirCacheBuilder.bad(DirCacheBuilder.java:278)
        at org.eclipse.jgit.dircache.DirCacheBuilder.resort(DirCacheBuilder.java:268)
        at org.eclipse.jgit.dircache.DirCacheBuilder.finish(DirCacheBuilder.java:224)
        at org.eclipse.jgit.merge.ResolveMerger.mergeTrees(ResolveMerger.java:1041)
        at org.eclipse.jgit.merge.ResolveMerger.mergeImpl(ResolveMerger.java:304)
        at org.eclipse.jgit.merge.Merger.merge(Merger.java:212)
        at org.eclipse.jgit.merge.Merger.merge(Merger.java:165)
        at org.eclipse.jgit.merge.ThreeWayMerger.merge(ThreeWayMerger.java:114)
        at com.google.gerrit.server.patch.AutoMerger.merge(AutoMerger.java:116)
        at com.google.gerrit.server.patch.PatchListLoader.aFor(PatchListLoader.java:393)
        at com.google.gerrit.server.patch.PatchListLoader.readPatchList(PatchListLoader.java:154)
        at com.google.gerrit.server.patch.PatchListLoader.call(PatchListLoader.java:122)
        at com.google.gerrit.server.patch.PatchListLoader.call(PatchListLoader.java:72)
        at com.google.gerrit.server.cache.h2.H2CacheImpl$LoadingCallable.call(H2CacheImpl.java:260)
        at com.google.gerrit.server.cache.h2.H2CacheImpl$LoadingCallable.call(H2CacheImpl.java:242)
        at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:5058)
        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3708)
        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2416)
        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2299)
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2212)
        ... 20 more
 

Comment 1 by marco.mm...@gmail.com, Jun 11 2018

Project Member
Owner: marco.mm...@gmail.com
Status: Started (was: New)

Comment 2 by david.pu...@gmail.com, Jun 12 2018

Cc: david.pu...@gmail.com

Comment 3 by marco.mm...@gmail.com, Jun 12 2018

Project Member
Note: such usage of Caffeine is, at least in this case, Ericsson-specific.

We are still working on isolating this issue further, trying to reduce the amount of data potentially involved into that query for our test-bed. Maybe caffeine usage has nothing to do with this issue; WIP then.

Comment 4 by huga...@gmail.com, Jun 12 2018

Project Member
To rule out caffeine, we just need to revert the caffeine change and try again or test this scenario using tip of stable-2.14 instead of our fork or stable-2.14

Comment 5 Deleted

Comment 6 by marco.mm...@gmail.com, Jun 13 2018

Project Member
Being fed with apparently accurate ES 2.4 data, I suspect JGit here to consider our two consecutive in-change, UTF-8 /Scandinavian (similar) filenames as the same path, hence as duplicate (0) stages.

Working on adding more traces to our test-bed JGit, so I can maybe see how these filenames or paths get decoded in DirCacheBuilder, right before throwing that exception in resort().

Comment 7 by marco.mm...@gmail.com, Jun 15 2018

Project Member
Components: -Elasticsearch Backend
Summary: IllegalStateException: Duplicate stages not allowed -from query involving changes with special characters (was: IllegalStateException: Duplicate stages not allowed for Elasticsearch query)
After flushing our caches and re-indexing the involved changes, our latest tests show this issue for both of our (Elasticsearch and Lucene indexed) nodes.

Comment 8 by marco.mm...@gmail.com, Jun 15 2018

Project Member
Description: Show this description

Comment 9 by marco.mm...@gmail.com, Jun 15 2018

Project Member
Description: Show this description

Comment 10 by marco.mm...@gmail.com, Jun 21 2018

Project Member
Status: ChangeUnderReview (was: Started)
https://git.eclipse.org/r/#/c/124860/
=>
Will need a corresponding Gerrit change to host the so-fixed jgit -once (or if) merged.

Comment 11 by david.pu...@gmail.com, Jul 3 2018

The change was submitted on jgit.

I've built a new jgit snapshot locally but I'm having trouble deploying it to the gerrit maven repo.

Comment 12 by marco.mm...@gmail.com, Jul 12 2018

Project Member
Please let us know if you think we can help in one part or another; thx btw.

Comment 13 by david.pu...@gmail.com, Jul 12 2018

It seems I'm not the only on having the problem, but so far there's no clue about what's wrong.

I'm not sure if there's any way to help, other than perhaps providing an alternative public maven repo that the jgit snapshot can be deployed to.

Also, there are still some other GC-related changes under review on the jgit project, so I want to wait for them to be submitted before upgrading JGit in gerrit anyway.

Comment 15 by david.pu...@gmail.com, Jul 30 2018

Labels: FixedIn-2.14.11
Status: Submitted (was: ChangeUnderReview)

Comment 16 by david.pu...@gmail.com, Jul 30 2018

Status: Released (was: Submitted)

Comment 17 by david.pu...@gmail.com, Sep 26

Labels: FixedIn-2.15.4

Comment 18 by david.pu...@gmail.com, Oct 10

 Issue 3981  has been merged into this issue.

Comment 19 by luca.mil...@gmail.com, Nov 20

Project Member
Labels: FixedIn-2.16

Sign in to add a comment