Hi,
we are using SonarQube Server 10.7.
Since we updated (extended) our quality profile, we get OutOfMemoryErrors when analyzing a merge request in a project with ~1,1 million lines. Before the update it worked with -Xmx4g
, now the problem even sometimes occurs with -Xmx6g
.
[...]
[INFO] Taint analysis for java: Starting
[INFO] 0 / 21709 UCFGs simulated, memory usage: 3015 MB
[INFO] 867 / 21709 UCFGs simulated, memory usage: 3139 MB
[INFO] 1509 / 21709 UCFGs simulated, memory usage: 2840 MB
[INFO] 2366 / 21709 UCFGs simulated, memory usage: 3068 MB
[INFO] 3471 / 21709 UCFGs simulated, memory usage: 2685 MB
[INFO] 4524 / 21709 UCFGs simulated, memory usage: 2652 MB
[INFO] 5586 / 21709 UCFGs simulated, memory usage: 3102 MB
[INFO] Too high simulation costs for sink in C:/Runners/gitlab-builds/09/my/custom/path/ECPooledRelationElement.java:3214. This sink will not be analyzed any further.
[INFO] Too high simulation costs for sink in C:/Runners/gitlab-builds/09/my/custom/path/ECPooledRelationElement.java:3168. This sink will not be analyzed any further.
[...]
several more similar lines
[...]
[INFO] Too high simulation costs for sink in C:/Runners/gitlab-builds/09/my/custom/path/ModelInstanceReference.java:1097. This sink will not be analyzed any further.
[INFO] 9217 / 21709 UCFGs simulated, memory usage: 4935 MB
[INFO] 10489 / 21709 UCFGs simulated, memory usage: 4752 MB
[...]
[INFO] 11465 / 21709 UCFGs simulated, memory usage: 5025 MB
[INFO] Too high simulation costs for sink in C:/Runners/gitlab-builds/09/my/custom/path/ECRelationElement.java:621. This sink will not be analyzed any further.
[INFO] Too high simulation costs for sink in C:/Runners/gitlab-builds/09/my/custom/path/ECPooledModelConcept.java:1764. This sink will not be analyzed any further.
[INFO] Too high simulation costs for sink in C:/Runners/gitlab-builds/09/my/custom/path/PatternMatcherHelper.java:102. This sink will not be analyzed any further.
[INFO] 12323 / 21709 UCFGs simulated, memory usage: 5239 MB
[INFO] 13172 / 21709 UCFGs simulated, memory usage: 5657 MB
[INFO] Too high simulation costs for sink in C:/Runners/gitlab-builds/09/my/custom/path/AttributeAssistant.java:118. This sink will not be analyzed any further.
[...]
several more similar lines
[...]
[INFO] Too high simulation costs for sink in C:/Runners/gitlab-builds/09/my/custom/path/AbstractWidgetRenderer.java:74. This sink will not be analyzed any further.
[INFO] 13723 / 21709 UCFGs simulated, memory usage: 5901 MB
[INFO] Too high simulation costs for sink in C:/Runners/gitlab-builds/09/my/custom/path/TranslationBroker.java:68. This sink will not be analyzed any further.
[...]
[INFO] 14429 / 21709 UCFGs simulated, memory usage: 6090 MB
[INFO] Too high simulation costs for sink in C:/Runners/gitlab-builds/09/my/custom/path/SimpleDatabase.java:962. This sink will not be analyzed any further.
[INFO] 15309 / 21709 UCFGs simulated, memory usage: 6098 MB
[INFO] Too high simulation costs for sink in C:/Runners/gitlab-builds/09/my/custom/path/FileCreator.java:665. This sink will not be analyzed any further.
java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid42660.hprof ...
[INFO] Time spent writing ucfgs 0ms
Heap dump file created [10323076039 bytes in 38.129 secs]
[...]
As you can see the memory usage increases, until the limit is reached.
There seems to be a mechanism to prevent this by aborting analyses which would be too costly, but this doesn’t help here.
The rules which were added by the rule set update are the following. One or more of them seem to cause these problems.
ID | Rule |
---|---|
S5147 | NoSQL operations should not be vulnerable to injection attacks |
S5496 | Server-side templates should not be vulnerable to injection attacks |
S5883 | OS commands should not be vulnerable to argument injection attacks |
S6096 | Extracting archives should not lead to zip slip vulnerabilities |
S6173 | Reflection should not be vulnerable to injection attacks |
S6287 | Applications should not create session cookies from untrusted input |
S6350 | Constructing arguments of system commands from user input is security-sensitive |
S6384 | Components should not be vulnerable to intent redirection |
S6390 | Thread suspensions should not be vulnerable to Denial of Service attacks |
S6398 | JSON operations should not be vulnerable to injection attacks |
S6399 | XML operations should not be vulnerable to injection attacks |
S6547 | Environment variables should not be defined from untrusted input |
S6549 | Accessing files should not lead to filesystem oracle attacks |
S7044 | Server-side requests should not be vulnerable to traversing attacks |
Does anyone have an idea on how to solve this?
Are these rules expected to need much more memory?
Why is the OOM not prevented by the mentioned mechanism?
Thanks!
Regards,
Carsten