Sonarqube 6.0 にアップグレードしてから、自分のプロジェクトの 1 つで分析を実行できませんでした。
このプロジェクトは、maven プラグインを介してソナー分析を実行し、次のエラーで失敗します。
Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar (default-cli) on project rating-parent: Error 500 on http://sonar.example.com/api/ce/submit?projectKey=com.example.rating-parent&projectName=Rating%20System&projectBranch=develop
サーバー (AJP を介して Apache 2.4 サーバーの背後にある) の sonar.log を調べると、次のスタックトレースが明らかになりました。
2016.08.12 10:50:14 ERROR web[o.s.s.w.WebServiceEngine] Fail to process request http://sonar.example.com/api/ce/submit?projectKey=com.example.rating:rating-parent&projectName=Rating%20System&projectBranch=develop
java.lang.IllegalStateException: Can't read file part
at org.sonar.server.ws.ServletRequest.readPart(ServletRequest.java:93) ~[sonar-server-6.0.jar:na]
at org.sonar.server.ws.ServletRequest.readInputStreamParam(ServletRequest.java:76) ~[sonar-server-6.0.jar:na]
at org.sonar.api.server.ws.internal.ValidatingRequest.paramAsInputStream(ValidatingRequest.java:74) ~[sonar-plugin-api-6.0.jar:na]
at org.sonar.server.ce.ws.SubmitAction.handle(SubmitAction.java:84) ~[sonar-server-6.0.jar:na]
at org.sonar.server.ws.WebServiceEngine.execute(WebServiceEngine.java:109) ~[sonar-server-6.0.jar:na]
at org.sonar.server.ws.WebServiceFilter.doFilter(WebServiceFilter.java:74) [sonar-server-6.0.jar:na]
at org.sonar.server.platform.MasterServletFilter$GodFilterChain.doFilter(MasterServletFilter.java:125) [sonar-server-6.0.jar:na]
at org.sonar.server.platform.MasterServletFilter.doFilter(MasterServletFilter.java:94) [sonar-server-6.0.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.sonar.server.user.UserSessionFilter.doFilter(UserSessionFilter.java:56) [sonar-server-6.0.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.sonar.server.platform.RoutesFilter.doFilter(RoutesFilter.java:55) [sonar-server-6.0.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.sonar.server.platform.ProfilingFilter.doFilter(ProfilingFilter.java:84) [sonar-server-6.0.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.0.32.jar:8.0.32]
at ch.qos.logback.access.tomcat.LogbackValve.invoke(LogbackValve.java:191) [logback-access-1.1.3.jar:na]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:868) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) [tomcat-embed-core-8.0.32.jar:8.0.32]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_91]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.0.32.jar:8.0.32]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91]
Caused by: java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (3736099) exceeds the configured maximum (2097152)
at org.apache.catalina.connector.Request.parseParts(Request.java:2846) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.connector.Request.parseParameters(Request.java:3151) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.connector.Request.getParameter(Request.java:1108) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.connector.RequestFacade.getParameter(RequestFacade.java:380) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.sonar.server.ws.ServletRequest.readParam(ServletRequest.java:71) ~[sonar-server-6.0.jar:na]
at org.sonar.api.server.ws.internal.ValidatingRequest.readParamOrDefaultValue(ValidatingRequest.java:134) ~[sonar-plugin-api-6.0.jar:na]
at org.sonar.api.server.ws.internal.ValidatingRequest.param(ValidatingRequest.java:86) ~[sonar-plugin-api-6.0.jar:na]
at org.sonar.api.server.ws.internal.ValidatingRequest.param(ValidatingRequest.java:68) ~[sonar-plugin-api-6.0.jar:na]
at org.sonar.api.server.ws.Request.mandatoryParam(Request.java:63) ~[sonar-plugin-api-6.0.jar:na]
at org.sonar.server.ce.ws.SubmitAction.handle(SubmitAction.java:81) ~[sonar-server-6.0.jar:na]
... 30 common frames omitted
Caused by: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (3736099) exceeds the configured maximum (2097152)
at org.apache.tomcat.util.http.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:811) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.tomcat.util.http.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:256) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.tomcat.util.http.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:280) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.connector.Request.parseParts(Request.java:2776) ~[tomcat-embed-core-8.0.32.jar:8.0.32]
... 39 common frames omitted
私が収集したのは、Sonarqube サーバーに送信される分析レポートのサイズ (約 3.7 MB) が、組み込み Tomcat サーバーのアップロード制限である約 2 MB を超えているという事実がエラーの原因であるということです。
target/sonar/batch-report のファイルの累積サイズは実際には約 3.7 MB であるため、スタック トレースは正しいと思います。
また、小規模なプロジェクトの 1 つ (合計約 1,3M のレポート) も試しましたが、問題なく動作します。
これを Jenkins サーバーから実行するか、コマンド ラインからローカルで Maven (3.3.9) を呼び出すかは問題ではありません。
レポートのサイズを減らす方法がないと仮定すると (3.7 MB は例外的ですか?)、Tomcat の最大アップロード サイズを増やすことでおそらくこれを修正できます。通常の Tomcat インストールでこれを行う方法は知っていますが、Sonarqube の組み込み Tomcat サーバーでこれを行う方法がわかりません。