Invoking method with ucfg - GC overhead limit exceeded

Hello,

During “Invoking method with ucfg” (on C# code analysis) following error occurs systematicaly “java.lang.OutOfMemoryError: GC overhead limit exceeded”.

  • Sonar version : 7.9.1.27448
  • Sonar c# scanner : 7.15 (build 8572)
  • Analysis additional properties :
    sonar.cs.vscoveragexml.reportsPaths=TestResults/**/.coveragexml
    sonar.inclusions= **/
    .cs,Scripts/*.js
  • Quality profiles : C# Sonar way BuiltIn

It happens since we bought the “Developer Edition”, previously with “Community edition” everything goes well and analaysis takes approxiamtivaly 15 min.
Analysis don’t failed on a specific method and analysis time is not constant as you can see on following logs :

build: 51088

2019-09-25T01:35:48.0735081Z 03:35:48.065 DEBUG: Invoking method with ucfg : ZZZ.YYY.Site.Commun.PageBase.WithStnId()
2019-09-25T01:35:56.0951577Z 03:35:56.082 INFO: ------------------------------------------------------------------------
2019-09-25T01:35:56.0952218Z 03:35:56.082 INFO: EXECUTION FAILURE
2019-09-25T01:35:56.0952459Z 03:35:56.082 INFO: ------------------------------------------------------------------------
2019-09-25T01:35:56.0956791Z 03:35:56.082 INFO: Total time: 23:16.364s
2019-09-25T01:35:56.2155807Z 03:35:56.207 INFO: Final Memory: 16M/1164M
2019-09-25T01:35:56.2157965Z ##[error]03:35:56.207 ERROR: Error during SonarQube Scanner execution
2019-09-25T01:35:56.2158749Z 03:35:56.207 ERROR: Error during SonarQube Scanner execution
2019-09-25T01:35:56.2158987Z 03:35:56.207 INFO: ------------------------------------------------------------------------
2019-09-25T01:35:56.2164995Z ##[error]java.lang.OutOfMemoryError: GC overhead limit exceeded
2019-09-25T01:35:56.2166078Z java.lang.OutOfMemoryError: GC overhead limit exceeded

build: 51031

2019-09-24T11:32:42.3950763Z 13:32:42.380 DEBUG: Invoking method with ucfg : ZZZ.YYY.Site.Commun.UserControlBase.GetLibelleI18N(string)
2019-09-24T11:34:16.5149901Z 13:34:16.506 INFO: ------------------------------------------------------------------------
2019-09-24T11:34:16.5150519Z 13:34:16.506 INFO: EXECUTION FAILURE
2019-09-24T11:34:16.5150811Z 13:34:16.506 INFO: ------------------------------------------------------------------------
2019-09-24T11:34:16.5153504Z 13:34:16.506 INFO: Total time: 22:34.975s
2019-09-24T11:34:16.6321113Z 13:34:16.631 INFO: Final Memory: 16M/1181M
2019-09-24T11:34:16.6323122Z ##[error]13:34:16.631 ERROR: Error during SonarQube Scanner execution
2019-09-24T11:34:16.6323818Z 13:34:16.631 ERROR: Error during SonarQube Scanner execution
2019-09-24T11:34:16.6324072Z 13:34:16.631 INFO: ------------------------------------------------------------------------
2019-09-24T11:34:16.6330455Z ##[error]java.lang.OutOfMemoryError: GC overhead limit exceeded
2019-09-24T11:34:16.6331096Z java.lang.OutOfMemoryError: GC overhead limit exceeded

build: 51003

2019-09-24T01:32:29.0597883Z 03:32:29.052 DEBUG: Invoking method with ucfg : ZZZ.YYY.Site.Composants.RisqueInterneEJ.CreateRow(System.Web.UI.WebControls.TableRowCollection, System.Collections.Generic.List<ZZZ.YYY.BO.Risque.EntiteAssuranceCredit>, ZZZ.YYY.BO.Risque.EntiteAssuranceCredit, string, bool, bool)
2019-09-24T01:32:29.0598541Z 03:32:29.052 DEBUG: Matching passthrough : System.Linq.Enumerable.Where(System.Collections.Generic.IEnumerable, System.Func<TSource, bool>)
2019-09-24T01:32:36.9616187Z 03:32:36.958 INFO: ------------------------------------------------------------------------
2019-09-24T01:32:36.9616925Z 03:32:36.958 INFO: EXECUTION FAILURE
2019-09-24T01:32:36.9617332Z 03:32:36.958 INFO: ------------------------------------------------------------------------
2019-09-24T01:32:36.9622230Z 03:32:36.958 INFO: Total time: 18:49.192s
2019-09-24T01:32:37.1062396Z 03:32:37.099 INFO: Final Memory: 16M/1130M
2019-09-24T01:32:37.1064417Z ##[error]03:32:37.099 ERROR: Error during SonarQube Scanner execution
2019-09-24T01:32:37.1065229Z 03:32:37.099 ERROR: Error during SonarQube Scanner execution
2019-09-24T01:32:37.1065468Z 03:32:37.099 INFO: ------------------------------------------------------------------------
2019-09-24T01:32:37.1071479Z ##[error]java.lang.OutOfMemoryError: GC overhead limit exceeded
2019-09-24T01:32:37.1072483Z java.lang.OutOfMemoryError: GC overhead limit exceeded

build: 50960

2019-09-23T15:25:07.4653721Z 17:25:07.460 DEBUG: Invoking method with ucfg : ZZZ.YYY.Site.Rapports.TableauBordBalancesAgees.ConvertirDecimalString(decimal, int)
2019-09-23T15:25:13.4213489Z 17:25:13.413 INFO: ------------------------------------------------------------------------
2019-09-23T15:25:13.4214701Z 17:25:13.413 INFO: EXECUTION FAILURE
2019-09-23T15:25:13.4215486Z 17:25:13.413 INFO: ------------------------------------------------------------------------
2019-09-23T15:25:13.4219397Z 17:25:13.413 INFO: Total time: 12:44.954s
2019-09-23T15:25:13.5621538Z ##[error]17:25:13.546 ERROR: Error during SonarQube Scanner execution
2019-09-23T15:25:13.5622394Z 17:25:13.546 ERROR: Error during SonarQube Scanner execution
2019-09-23T15:25:13.5622602Z 17:25:13.546 INFO: Final Memory: 16M/1137M
2019-09-23T15:25:13.5622839Z 17:25:13.546 INFO: ------------------------------------------------------------------------
2019-09-23T15:25:13.5632226Z ##[error]java.lang.OutOfMemoryError: GC overhead limit exceeded
2019-09-23T15:25:13.5634009Z java.lang.OutOfMemoryError: GC overhead limit exceeded

build: 50948

2019-09-23T14:40:07.4878186Z 16:40:07.483 DEBUG: Invoking method with ucfg : ZZZ.YYY.Site.Commun.PageBase.TicketSTN.get
2019-09-23T14:41:18.7301571Z 16:41:18.724 INFO: ------------------------------------------------------------------------
2019-09-23T14:41:18.7302032Z 16:41:18.724 INFO: EXECUTION FAILURE
2019-09-23T14:41:18.7303395Z 16:41:18.724 INFO: ------------------------------------------------------------------------
2019-09-23T14:41:18.7304312Z 16:41:18.724 INFO: Total time: 14:32.344s
2019-09-23T14:41:18.8680689Z 16:41:18.851 INFO: Final Memory: 16M/1243M
2019-09-23T14:41:18.8681335Z 16:41:18.851 INFO: ------------------------------------------------------------------------
2019-09-23T14:41:18.8682725Z ##[error]16:41:18.851 ERROR: Error during SonarQube Scanner execution
2019-09-23T14:41:18.8683466Z 16:41:18.851 ERROR: Error during SonarQube Scanner execution
2019-09-23T14:41:18.8693925Z ##[error]java.lang.OutOfMemoryError: GC overhead limit exceeded
2019-09-23T14:41:18.8694630Z java.lang.OutOfMemoryError: GC overhead limit exceeded

As explain in the documentation, we allocate a larger heap but there is no improvement.

Server memory configuration :

  • Physical : 42(GB)
  • Heap Max
    - Web : 3072(MB)
    - Compute Engine : 6144(MB)
    - Search Engine : 31744(MB) (maximum allowed according documentation)

Monitoring don’t show 100% usage of memory (same for CPU).

Any help would be appreciated.

Hi,

With the “Developer Edition”, you get new security rules. Your logs seem to indicate that the error you get is related to those security rules.

The error happens on the scanner side (“Error during SonarQube Scanner execution”), so the “server memory configuration” is not relevant here… You should look into the SONAR_SCANNER_OPTS environment variable which is mentioned in the troubleshooting section of the scanner documentation.

1 Like

Thk’s for your answer Pierre-Yves.
I’ll try to tweak SONAR_SCANNER_OPTS environment variable and tell you if it’s better.

We try following value :

SONAR_SCANNER_OPTS=-Xmx8192m

But there is no improvement.

Is there a way to disable these new security rules ?

Maybe you can check that your setting was taken into account by looking at the line of the logs where you had something like Final Memory: 16M/1243M: you should now see a much higher value.

To disable the related security rules, you have to adjust the quality profile used for the analyzed project. Look for the C# rules which belong to the “Repository” named “Security SonarAnalyzerC#” (example) and disable them in the quality profile of your project.

Finally increasing SONAR_SCANNER_OPTS is the solution to our problem (first time we increase it, it doesn’t work because we forget to reboot the server).

Thk’s for your help Pierre-Yves.

Thanks for letting us know!