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

Web service api/plugins/uninstall fails when plugin is already being uninstalling

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.7
    • Component/s: Marketplace, Web API
    • Labels:

      Description

      The web service POST api/plugins/uninstall fails with code 500 and message "An error has occurred. Please contact your administrator" when it has already being called for the same plugin.

      1. GET api/plugins/installed returns the plugin with key `java`
      2. POST api/plugins/uninstall?plugin=java returns 204
      3. GET api/plugins/installed still returns the plugin with key `java`. It will be uninstalled on next restart of server.
      4. POST api/plugins/uninstall?plugin=java returns 500. Web service should be idempotent and return 204.

      Server logs contain error :

      2017.05.26 17:57:10 ERROR web[AVxFd8nXws77ZUU8AAAa][o.s.s.w.WebServiceEngine] Fail to process request http://localhost:9000/api/plugins/uninstall?key=java
      java.lang.IllegalStateException: Fail to uninstall plugin SonarJava [java]
      	at org.sonar.server.plugins.ServerPluginRepository.uninstall(ServerPluginRepository.java:309)
      	at org.sonar.server.plugins.ws.UninstallAction.handle(UninstallAction.java:65)
      	at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:103)
      	at org.sonar.server.ws.WebServiceFilter.doFilter(WebServiceFilter.java:86)
      	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:192)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
      	at org.sonar.server.user.UserSessionFilter.doFilter(UserSessionFilter.java:76)
      	at org.sonar.server.user.UserSessionFilter.doFilter(UserSessionFilter.java:63)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
      	at org.sonar.server.platform.web.SecurityServletFilter.doHttpFilter(SecurityServletFilter.java:72)
      	at org.sonar.server.platform.web.SecurityServletFilter.doFilter(SecurityServletFilter.java:48)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
      	at org.sonar.server.platform.web.RedirectFilter.doFilter(RedirectFilter.java:61)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
      	at org.sonar.server.platform.web.requestid.RequestIdFilter.doFilter(RequestIdFilter.java:63)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
      	at org.sonar.server.platform.web.RootFilter.doFilter(RootFilter.java:62)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
      	at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
      	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:87)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
      	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
      	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798)
      	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434)
      	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      	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)
      Caused by: java.io.FileNotFoundException: Source xxxx/extensions/plugins/sonar-java-plugin-4.9.0.9858.jar' does not exist
      	at org.apache.commons.io.FileUtils.moveFile(FileUtils.java:2819)
      	at org.apache.commons.io.FileUtils.moveFileToDirectory(FileUtils.java:2871)
      	at org.sonar.server.plugins.ServerPluginRepository.uninstall(ServerPluginRepository.java:307)
      	... 43 common frames omitted
      

      Note that the web service correctly returns 400 "Plugin [xxx] is not installed" when the plugin is not installed.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                duarte.meneses Duarte Meneses
                Reporter:
                simon.brandhof Simon Brandhof
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: