500 error while accessing project ACCESS tab in polygerrit

73 views
Skip to first unread message

Ansar

unread,
Jun 10, 2020, 12:22:42 PM6/10/20
to Repo and Gerrit Discussion
Hi All,

Recently we have upgraded gerrit to 2.16.17 and we could see couple of projects access tab giving 500 error in polygerrit but in old UI everything working fine. 

Error picture attached and the error logs as below, 

Enter code here...[2020-06-10 14:44:18,216] [HTTP GET /projects/test (lkunjumo from 10.143.93.117)] ERROR com.google.gerrit.httpd.restapi.RestApiServlet :
 Error in GET /projects/test
java.lang.IllegalStateException: Duplicate key Fails
        at java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
        at java.util.HashMap.merge(HashMap.java:1254)
        at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
        at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
        at com.google.gerrit.server.project.ProjectJson.format(ProjectJson.java:52)
        at com.google.gerrit.server.restapi.project.GetProject.apply(GetProject.java:36)
        at com.google.gerrit.server.restapi.project.GetProject.apply(GetProject.java:24)
        at com.google.gerrit.httpd.restapi.RestApiServlet.service(RestApiServlet.java:458)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
        at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:290)
        at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:280)
        at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:184)
        at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:89)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:85)
        at com.google.gerrit.httpd.raw.StaticModule$PolyGerritFilter.doFilter(StaticModule.java:485)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at com.google.gerrit.httpd.GetUserFilter.doFilter(GetUserFilter.java:92)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at com.google.gerrit.httpd.RequireSslFilter.doFilter(RequireSslFilter.java:72)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at com.google.gerrit.httpd.RunAsFilter.doFilter(RunAsFilter.java:121)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at com.google.gerrit.httpd.GwtCacheControlFilter.doFilter(GwtCacheControlFilter.java:72)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at com.google.gerrit.httpd.SetThreadNameFilter.doFilter(SetThreadNameFilter.java:62)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at com.google.gerrit.httpd.AllRequestFilter$FilterProxy$1.doFilter(AllRequestFilter.java:133)
        at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:239)
        at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:215)
        at com.googlesource.gerrit.plugins.javamelody.GerritMonitoringFilter.doFilter(GerritMonitoringFilter.java:66)
        at com.google.gerrit.httpd.AllRequestFilter$FilterProxy$1.doFilter(AllRequestFilter.java:129)
        at com.google.gerrit.httpd.AllRequestFilter$FilterProxy.doFilter(AllRequestFilter.java:135)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at com.google.gerrit.httpd.RequestCleanupFilter.doFilter(RequestCleanupFilter.java:60)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at com.google.gerrit.httpd.RequestMetricsFilter.doFilter(RequestMetricsFilter.java:57)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at com.google.gerrit.httpd.RequestContextFilter.doFilter(RequestContextFilter.java:64)
        at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
        at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:121)
        at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:133)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1607)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1297)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1577)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1212)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:54)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
        at org.eclipse.jetty.server.Server.handle(Server.java:500)
 at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
        at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:270)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
        at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:388)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
        at java.lang.Thread.run(Thread.java:748)


Thank You! 

gerrit-internal-server-error.PNG

David Ostrovsky

unread,
Jun 10, 2020, 2:05:34 PM6/10/20
to Repo and Gerrit Discussion

Am Mittwoch, 10. Juni 2020 18:22:42 UTC+2 schrieb Ansar:
Hi All,

Recently we have upgraded gerrit to 2.16.17 and we could see couple of projects access tab giving 500 error in polygerrit but in old UI everything working fine. 

Error picture attached and the error logs as below, 

Enter code here...[2020-06-10 14:44:18,216] [HTTP GET /projects/test (lkunjumo from 10.143.93.117)] ERROR com.google.gerrit.httpd.restapi.RestApiServlet :
 Error in GET /projects/test
java.lang.IllegalStateException: Duplicate key Fails
        at java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
        at java.util.HashMap.merge(HashMap.java:1254)
        at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
        at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
        at com.google.gerrit.server.project.ProjectJson.format(ProjectJson.java:52)

This shouldn't happen. Can it be that label configuration
for those projects is broken and that the label values are
not unique, like this broken label, with duplicate -1 value:

"Verified_broken":{
         "values":{
            " 0":"No score",
            "-1":"Fails",
            "-1":"Fails really hard",
            "+1":"Verified"
         },
         "default_value":0
      }

I've uploaded a fix and added diagnostic message, untested: [1].

Sven Selberg

unread,
Jun 11, 2020, 3:48:26 AM6/11/20
to Repo and Gerrit Discussion
Shouldn't this be caught by validation?
Are the project.configs updated behind Gerrit's back?

Ansar

unread,
Jun 18, 2020, 3:33:15 PM6/18/20
to Repo and Gerrit Discussion
Hi David,

Yes it is due to the same value using in label configuration but modifying that also creating an issue here for applying for many branches. PFB 
[label "TEST-Review"]
        branch = refs/heads/B1
        function = MaxWithBlock 
        value = -1 Fails 
        value = 0 No score 
        value = +1 Success 
        defaultValue = 0
[label "TEST-Review"]
        branch = refs/heads/B2
        function = MaxWithBlock 
        value = -1 Fails 
        value = 0 No score 
        value = +1 Success 
        defaultValue = 0

 Here the label named "TEST-Review" is same but differentiating with branches, While adding the same label for many branches then it is throwing 500 internal error,

is that okay to use many branches together in single label as below 

 
[label "TEST-Review"]
        branch = refs/heads/B2
        branch = refs/heads/B3
        branch = refs/heads/B4
        branch = refs/heads/B5
        function = MaxWithBlock 
        value = -1 Fails 
        value = 0 No score 
        value = +1 Success 
        defaultValue = 0


David Ostrovsky

unread,
Jun 21, 2020, 8:03:59 AM6/21/20
to Repo and Gerrit Discussion

On Thursday, June 18, 2020 at 9:33:15 PM UTC+2, Ansar wrote:
Hi David,

Yes it is due to the same value using in label configuration but modifying that also creating an issue here for applying for many branches. PFB 
[label "TEST-Review"]
        branch = refs/heads/B1
        function = MaxWithBlock 
        value = -1 Fails 
        value = 0 No score 
        value = +1 Success 
        defaultValue = 0
[label "TEST-Review"]
        branch = refs/heads/B2
        function = MaxWithBlock 
        value = -1 Fails 
        value = 0 No score 
        value = +1 Success 
        defaultValue = 0

 Here the label named "TEST-Review" is same but differentiating with branches, While adding the same label for many branches then it is throwing 500 internal error,

This configuration is invalid, and this is a Gerrit bug, that this project config
is/was accepted.

Also since this fix: [1], that is included since 3.2 release, but should have been
cherry-picked to earlier gerrit releases, the gerrit would reject duplicated label
definitions:

Invalid project configuration:
    project.config: Duplicate value "-1 Negative" for label "CustomLabel"
    project.config: Duplicate value "0 No Score" for label "CustomLabel"
    project.config: Duplicate value "1 Positive" for label "CustomLabel"
 

is that okay to use many branches together in single label as below 

 
[label "TEST-Review"]
        branch = refs/heads/B2
        branch = refs/heads/B3
        branch = refs/heads/B4
        branch = refs/heads/B5
        function = MaxWithBlock 
        value = -1 Fails 
        value = 0 No score 
        value = +1 Success 
        defaultValue = 0


This configuration is correct. This unit test is passing, as expected:

  @Test
  public void readConfigLabelWithMultipleBranches() throws Exception {
    RevCommit rev =
        tr.commit()
            .add("groups", group(developers))
            .add(
                "project.config",
                "[label \"CustomLabel\"]\n"
                    + "  branch = refs/heads/stable-1.0\n"
                    + "  branch = refs/heads/stable-2.0\n"
                    + "  value = -1 Negative\n"
                    + "  value = 0 No Score\n"
                    + "  value =  1 Positive\n"
                    + "  defaultValue = -1\n")
            .create();

    ProjectConfig cfg = read(rev);
    Map<String, LabelType> labels = cfg.getLabelSections();

    assertThat(labels.entrySet().iterator().next().getValue().getRefPatterns())
        .containsExactlyElementsIn(
            ImmutableList.of("refs/heads/stable-1.0", "refs/heads/stable-2.0"))
        .inOrder();
  }


David Pursehouse

unread,
Jun 21, 2020, 9:17:05 AM6/21/20
to David Ostrovsky, Repo and Gerrit Discussion
On Sun, Jun 21, 2020 at 9:04 PM David Ostrovsky <david.o...@gmail.com> wrote:

On Thursday, June 18, 2020 at 9:33:15 PM UTC+2, Ansar wrote:
Hi David,

Yes it is due to the same value using in label configuration but modifying that also creating an issue here for applying for many branches. PFB 
[label "TEST-Review"]
        branch = refs/heads/B1
        function = MaxWithBlock 
        value = -1 Fails 
        value = 0 No score 
        value = +1 Success 
        defaultValue = 0
[label "TEST-Review"]
        branch = refs/heads/B2
        function = MaxWithBlock 
        value = -1 Fails 
        value = 0 No score 
        value = +1 Success 
        defaultValue = 0

 Here the label named "TEST-Review" is same but differentiating with branches, While adding the same label for many branches then it is throwing 500 internal error,

This configuration is invalid, and this is a Gerrit bug, that this project config
is/was accepted.

Also since this fix: [1], that is included since 3.2 release, but should have been
cherry-picked to earlier gerrit releases, the gerrit would reject duplicated label
definitions:

It needed some adaptation to work on that branch.


 
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/2a221a86-e0f5-42f7-ab42-7cd20033b34co%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages