GC overhead limit exceeded: Docker

SonarQube version : 7.6
MySQL version: 5.7.28

The error I get when I try to run my sonar container (linked with mySQL container) is:

2020.02.04 07:31:27 INFO web[o.s.s.r.RegisterRules] Register rules
java.lang.OutOfMemoryError: GC overhead limit exceeded
Dumping heap to java_pid148.hprof …
Heap dump file created [453507783 bytes in 4.052 secs]
2020.02.04 07:31:57 ERROR web[o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.nio.CharBuffer.allocate(CharBuffer.java:335)
at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:795)
at java.nio.charset.Charset.decode(Charset.java:807)
at com.mysql.jdbc.StringUtils.toString(StringUtils.java:2253)
at com.mysql.jdbc.ResultSetRow.getString(ResultSetRow.java:701)
at com.mysql.jdbc.BufferRow.getString(BufferRow.java:527)
at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5255)
at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5138)
at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5177)
at org.apache.commons.dbcp2.DelegatingResultSet.getString(DelegatingResultSet.java:898)
at org.apache.commons.dbcp2.DelegatingResultSet.getString(DelegatingResultSet.java:898)
at org.apache.ibatis.type.StringTypeHandler.getNullableResult(StringTypeHandler.java:37)
at org.apache.ibatis.type.StringTypeHandler.getNullableResult(StringTypeHandler.java:26)
at org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:66)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.applyAutomaticMappings(DefaultResultSetHandler.java:520)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:401)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForSimpleResultMap(DefaultResultSetHandler.java:355)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:330)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:303)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:196)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:60)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:139)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:76)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)

I am trying to run the docker image using the command:

docker run -d --name SonarQube --link sonar_db:sonar_db -p 9000:9000 -e “-XX:-UseGCOverheadLimit” -e “-Xms2048m -Xmx4096m -Xss10m -XX:PermSize=512m -XX:MaxPermSize=2048m” sonar

I have tried a combination of these commands but nothing seems to work, can you help me with this?

Hello,

it seems like you have built this image yourself.
My advise would be to try to run this image removing the `-e “-Xms2048m -Xmx4096m -Xss10m -XX:PermSize=512m -XX:MaxPermSize=2048m” since it is not clear to me to which JVM those Java properties will be passed while spawning the container.

The startup process fails on below

2020.02.04 07:31:27 INFO web[o.s.s.r.RegisterRules] Register rules
java.lang.OutOfMemoryError: GC overhead limit exceeded

So it seem like the OOM happens on the WebServer process.
You may want to connect to the container in interactive mode and modify the Xmx of the Webserver directly and see if that helped.

Have a look at https://hub.docker.com/_/sonarqube and download more recent and official image since 7.6 is old and not supported anymore.

Hi,

Yes, I’ve built the image myself.
I’ve tried running the command without the given parameters.
Also, the container doesn’t start, the same error keeps popping up, I’ve noticed that when I do not specify the link to my database(sql-container), sonarqube boots up but whenever I start it up using my db, it fails with this error.

I’ve dumped a db backup of sonar in the sql container, its size is approximately 20GB.

Any thoughts on this?

Hi,

Yes, I’ve built the image myself.

OK, there are many thigns that could have gone wrong. The 7.6 version is already old - why wouldn’t you use the recent officail image and base your experiments on it?

Also, the container doesn’t start

Per the previous logs you shared the container start - it SQ WebServer process that fails to start due to OOM errror. You need to find a way to bump up the Xmx on it inside the container - I previously suggested connecting to the container in interactive mode and editing the config file directly - it still constitutes a valid option.

Hope that helps.
Kris