Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-8712

Quality Gate cannot be fetched if it includes a custom metric that was deleted

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.6, 6.2
    • Fix Version/s: 6.4
    • Component/s: Quality Gate
    • Labels:

      Description

      Steps to reproduce:

      • Create a (numeric) customer metric (eg quality-index)
      • Use this metric in a a quality gate (if quality-index < 5 then QG status = Error)
      • Delete the custom metric
      • Try to access the quality gate. It is not longer reachable:
        • Blank screen in UI
        • Error in the APIs
          2017.01.26 16:04:13 ERROR web[AVnbQaxenQ1JC5lsAABP][o.s.s.w.WebServiceEngine] Fail to process request http://localhost:9000/api/qualitygates/show?id=1
          java.lang.IllegalStateException: Could not find metric with id 162 
             at org.sonar.server.qualitygate.QualityGates.listConditions(QualityGates.java:169)
             at org.sonar.server.qualitygate.ws.ShowAction.handle(ShowAction.java:72)
             at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:108)
             at org.sonar.server.ws.WebServiceFilter.doFilter(WebServiceFilter.java:74)
             at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(MasterServletFilter.java:126)
             at org.sonar.server.platform.web.MasterServletFilter.doFilter(MasterServletFilter.java:95)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
             at org.sonar.server.user.UserSessionFilter.doFilter(UserSessionFilter.java:83)
             at org.sonar.server.user.UserSessionFilter.doFilter(UserSessionFilter.java:66)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
             at org.sonar.server.platform.web.SecurityServletFilter.doHttpFilter(SecurityServletFilter.java:73)
             at org.sonar.server.platform.web.SecurityServletFilter.doFilter(SecurityServletFilter.java:49)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
             at org.sonar.server.platform.web.RoutesFilter.doFilter(RoutesFilter.java:55)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
             at org.sonar.server.platform.web.requestid.RequestIdFilter.doFilter(RequestIdFilter.java:63)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
             at org.sonar.server.platform.web.RootFilter.doFilter(RootFilter.java:62)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
             at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:256)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
             at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
             at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
             at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
             at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
             at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
             at java.lang.Thread.run(Thread.java:745)
          

      To fix the problem you have to delete the QG condition on the custom metric directly in the database. Quality gate is back after that.

      Problem reproduced on 5.6.5 and 6.2

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julien.lancelot Julien Lancelot
                Reporter:
                olivier.korach Olivier Korach
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: