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

Upload big analysis report can cause OutOfMemory errors on web server

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.2, 6.3.1, 6.3.2
    • Fix Version/s: 6.4
    • Component/s: Scanner, Web API
    • Labels:

      Description

      OOM errors have been reported on internal SQ server running SQ 6.2 with the following stacktrace:

      java.lang.OutOfMemoryError: Java heap space
              at java.lang.StringCoding$StringDecoder.decode(StringCoding.java:149)
              at java.lang.StringCoding.decode(StringCoding.java:193)
              at java.lang.String.<init>(String.java:426)
              at java.lang.String.<init>(String.java:491)
              at org.apache.tomcat.util.http.fileupload.disk.DiskFileItem.getString(DiskFileItem.java:321)
              at org.apache.catalina.core.ApplicationPart.getString(ApplicationPart.java:126)
              at org.apache.catalina.connector.Request.parseParts(Request.java:2804)
              at org.apache.catalina.connector.Request.parseParameters(Request.java:3151)
              at org.apache.catalina.connector.Request.getParameter(Request.java:1108)
              at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:380)
              at javax.servlet.ServletRequestWrapper.getParameter(ServletRequestWrapper.java:153)
              at org.sonar.server.ws.ServletRequest.readParam(ServletRequest.java:74)
              at org.sonar.api.server.ws.internal.ValidatingRequest.readParamOrDefaultValue(ValidatingRequest.java:143)
              at org.sonar.api.server.ws.internal.ValidatingRequest.param(ValidatingRequest.java:98)
              at org.sonar.api.server.ws.internal.ValidatingRequest.param(ValidatingRequest.java:70)
              at org.sonar.api.server.ws.Request.mandatoryParam(Request.java:72)
              at org.sonar.server.ce.ws.SubmitAction.handle(SubmitAction.java:82)
              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)
      

      This error can be reproduced with SQ 6.4 (so, very likely with 6.3).

      Doing investigation in the tomcat code, it appears that unless a parameter has a file name as part of a multipart HTTP request, this parameter will be parsed, ie. loaded in memory, whenever a method getParameter, getParameterNames, ... is called.

      Therefore, the error is on the side of the code used by the scanner which does not provide the HTTP header for the "report" parameter (which contains the report file content).

        Attachments

          Activity

            People

            Assignee:
            sebastien.lesaint Sebastien Lesaint
            Reporter:
            sebastien.lesaint Sebastien Lesaint
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: