Dear Sonarqube community,
since update to Sonarqube 6.1 we are getting an error within Sonarqube where a Packet for query is too large. What we do: Jenkins is checking out PHP source code, then SonarQube Scanner is analyzing the source code and communicates with the SonarQube server. This process is failing with the log output in Jenkins:
org.sonarqube.ws.client.HttpException: Error 500 on http://URL-TO-SONAR/sonar/api/ce/submit?projectKey=lhind.php.PRJName&projectName=PRJName : {"errors":[{"msg":"Fail to insert data of CE task AViRLtiaB_5m8twj_1J3"}]}
We alread increased the max packet size and innodb_log_file_size. We DO NOT had this problem with the same amount of code with SonarQube 6.1.
Any ideas?
In SonarQube we got the following exception in sonar.log file:
2016.11.23 12:35:16 ERROR web[][o.s.s.w.WebServiceEngine] Fail to process request http://SONAR-URL.de:8443/sonar/api/ce/submit?projectKey=lhind.php.PRJName&projectName=PRJName
java.lang.IllegalStateException: Fail to insert data of CE task AViRLtiaB_5m8twj_1J3
at org.sonar.db.ce.CeTaskInputDao.insert(CeTaskInputDao.java:56) ~[sonar-db-6.1.jar:na]
(deleted because too much text ...)
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_111]
**Caused by: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (24313938 > 16777216). You can change this value on the server by setting the max_allowed_packet' variable.**
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3671) ~[mysql-connector-java-5.1.39.jar:5.1.39]
(deleted because too much text ...)
at org.sonar.db.ce.CeTaskInputDao.insert(CeTaskInputDao.java:53) ~[sonar-db-6.1.jar:na]
... 34 common frames omitted
Increase the maximum allowed packet size in MySQL on both the client and server to work around this problem.
Server
See the Resolution section here for details about how to do this on the server. The recommendation there is to set this value to 256MB. In the stacktrace above, the packet size is around 24MB.
https://confluence.atlassian.com/confkb/exceeds-max-allowed-packet-for-mysql-179443425.html
I like the link above because it describes how to increase the value without stopping the database, if that's important to you.
Client
On the client, increase the value of the maxAllowedPacket
parameter in the SonarQube JDBC URL.
Reference
For more details, see the following links in the MySQL documentation.
Both the client and the server have their own max_allowed_packet variable, so if you want to handle big packets, you must increase this variable both in the client and in the server.
maxAllowedPacket
Maximum allowed packet size to send to server. If not set, the value of system variable 'max_allowed_packet' will be used to initialize this upon connecting. This value will not take effect if set larger than the value of 'max_allowed_packet'. Also, due to an internal dependency with the property "blobSendChunkSize", this setting has a minimum value of "8203" if "useServerPrepStmts" is set to "true".
Default: -1
Since version: 5.1.8
I had a same issue however, we had a limitation where we could not change the MySQL server configuration (max_allowed_packet)
I was able to get this working by changing the Client side jdbc URL configurations -> leaving the server config as is.
Note that we have to use 'useServerPrepStmts=true' here.
jdbc:mysql://[dbhost]:[dbport]?useUnicode=true&rewriteBatchedStatements=true&characterEncoding=utf8&useServerPrepStmts=true&maxAllowedPacket=20000000&useSSL=false
Check the mysql connector config reference here
There is one more post on SO that talks abt Client side change in detail - check here
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With