我們的設置是SonarQube服務器5.6.5 LTS和TFS2017內部部署服務器。SonarQube上的Timout對TFS2017的分析
我正在一個大的解決方案上運行代碼分析,這個解決方案需要大約15分鐘的時間才能完成分析構建步驟。 在「完整SonarQube分析」構建步驟,我得到以下錯誤:
2017-01-31T08:52:44.8355200Z 09:52:44.741 Post-processing succeeded.
2017-01-31T08:52:46.9293440Z Waiting on the SonarQube server to finish processing in order to determine the quality gate status.
2017-01-31T08:57:47.7364532Z ##[error]System.Management.Automation.RuntimeException: The analysis did not complete in the allotted time of 300 seconds. Consider setting the build variable SonarQubeAnalysisTimeoutInSeconds to a higher value. ---> System.Management.Automation.RuntimeException: The analysis did not complete in the allotted time of 300 seconds. Consider setting the build variable SonarQubeAnalysisTimeoutInSeconds to a higher value.
2017-01-31T08:57:47.7364532Z --- Ende der internen Ausnahmestapelüberwachung ---
2017-01-31T08:57:47.7364532Z bei System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
2017-01-31T08:57:47.7364532Z bei System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
2017-01-31T08:57:47.7364532Z bei System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
2017-01-31T08:57:47.7364532Z bei System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-01-31T08:57:47.7364532Z bei System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-01-31T08:57:47.7364532Z bei Microsoft.TeamFoundation.DistributedTask.Handlers.LegacyVSTSPowerShellHost.VSTSPowerShellHost.Main(String[] args)
2017-01-31T08:57:47.7676884Z ##[error]LegacyVSTSPowerShellHost.exe completed with return code: -1.
2017-01-31T08:57:47.7676884Z ##[section]Finishing: Complete the SonarQube analysis
控制選項設置爲零/無窮的建立超時步驟。我在哪裏可以設置SonarQubeAnalysisTimeoutInSeconds
或者是否有其他超時設置,我應該設置更高?
如果我在準備構建任務中取消選中「在構建摘要中包含完整分析報告」,構建運行爲綠色。 但在兩種情況下,在SonarQube Sever的日誌一OutOfMemoryError
:
2017.01.31 09:54:10 INFO [o.s.s.c.s.ComputationStepExecutor] Compute duplication measures | time=399ms
2017.01.31 09:54:56 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AVnzuYyFhG9cSXnted2v
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source) ~[na:1.8.0_121]
at java.lang.AbstractStringBuilder.ensureCapacityInternal(Unknown Source) ~[na:1.8.0_121]
at java.lang.AbstractStringBuilder.append(Unknown Source) ~[na:1.8.0_121]
at java.lang.StringBuilder.append(Unknown Source) ~[na:1.8.0_121]
at org.sonar.server.computation.step.DuplicationDataMeasuresStep$DuplicationVisitor.appendDuplication(DuplicationDataMeasuresStep.java:131) ~[sonar-server-5.6.5.jar:na]
...
難道這些錯誤2相關?
當您選中「在構建摘要中包含完整分析報告」時,任務將等待分析完成,然後繼續執行下一個任務。如果您想將質量門狀態置於構建報告中,這會很有用,但會降低構建速度。服務器上SonarQube進程的可用內存是多少?您可能想要查看[系統需求頁](https://docs.sonarqube.org/display/SONAR/Requirements)以獲取有關SonarQube性能的更多信息。 –
我之前就知道這個頁面,因爲我們在服務器上有4GB內存,所以我不在乎配置javaOpts屬性。我現在明確地將這些值設置爲建議的2GB XMX和512MB XMS - 現在一切都很好。 – phifi