由于声纳从3.4.1升级到4.3.2,我们注意到在该过程之后数据库会话没有被关闭。我们一直使用20个连接限制的默认设置,但是在升级之后,我们发现我们在几个小时内消耗了20个连接,因此不得不每天重启服务器几次。
### Error querying database. Cause: org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
### The error may exist in org.sonar.core.source.db.SnapshotDataMapper
将sonar.jdbc.maxActive撞到250之后,我们仍然需要每天重新启动Sonar服务器以使声纳运行。
我们非常感谢您对本期杂志的任何见解/建议。
DataBase:带有ojdbc6.jar的Oracle 11.2服务器(Oracle网站上的最新版本)
Java:JDK1.7
sonar.jdbc.maxActive=250
sonar.jdbc.maxIdle=25
sonar.jdbc.minIdle=2
sonar.jdbc.maxWait=5000
sonar.jdbc.minEvictableIdleTimeMillis=600000
sonar.jdbc.timeBetweenEvictionRunsMillis=30000
sonar-checkstyle-plugin-2.1.jar
sonar-cobertura-plugin-1.6.2.jar
sonar-findbugs-plugin-2.3.jar
sonar-jacoco-plugin-2.3.jar
sonar-java-plugin-2.3.jar
sonar-javascript-plugin-1.6.jar
sonar-pmd-plugin-2.2.jar
sonar-squid-java-plugin-2.3.jar
sonar-surefire-plugin-2.3.jar
# Java Additional Parameters
wrapper.java.additional.1=-Djava.awt.headless=true
wrapper.java.additional.2=-XX:MaxPermSize=160m
wrapper.java.additional.3=-XX:+HeapDumpOnOutOfMemoryError
wrapper.java.additional.4=-Dfile.encoding=UTF-8
wrapper.java.additional.5=-Djruby.management.enabled=false
# Maximum amount of memory of Java VM
wrapper.java.additional.6=-Xmx2048M
# RECOMMENDED : uncomment if Java Virtual Machine is a JDK but not a JRE. To know which JVM you use, execute
# 'java -version'. JDK displays 'Server VM'.
wrapper.java.additional.7=-server
# Initial JVM heap size (in MB)
wrapper.java.initmemory=1024
#********************************************************************
# Wrapper Java Properties
#********************************************************************
# JVM
# Can be an absolute path, for example:
#wrapper.java.command=/path/to/my/jdk/bin/java
#wrapper.java.command=java
wrapper.java.command=/ENTIRE_PATH/jdk1.7/bin/java
# Java Main class. This class must implement the WrapperListener interface
# or guarantee that the WrapperManager class is initialized. Helper
# classes are provided to do this for you. See the Integration section
# of the documentation for details.
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
# Java Classpath (include wrapper.jar) Add class path elements as
# needed starting from 1
wrapper.java.classpath.1=../../lib/*.jar
wrapper.java.classpath.2=../../conf
wrapper.java.classpath.3=../../extensions/jdbc-driver/h2/*.jar
wrapper.java.classpath.4=../../extensions/jdbc-driver/mysql/*.jar
wrapper.java.classpath.5=../../extensions/jdbc-driver/oracle/*.jar
wrapper.java.classpath.6=../../extensions/jdbc-driver/postgresql/*.jar
wrapper.java.classpath.7=../../extensions/jdbc-driver/mssql/*.jar
# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=./lib
# Application parameters. Add parameters as needed starting from 1
wrapper.app.parameter.1=org.sonar.application.StartServer
# Do not touch the following property. Max memory is set with -Xmx (see above).
# See https://jira.codehaus.org/browse/SONAR-5204
wrapper.java.maxmemory=0
答案 0 :(得分:0)
你说“过程后数据库会话没有被关闭”。这个过程是什么?这些数据库连接是在代码分析期间打开的,还是仅用于SonarQube仪表板(或两者)的日常咨询?
你如何推出你的分析? Sonar-Runner还是Jenkins?您是否更改了配置中的内容?
答案 1 :(得分:0)
我遇到了这个问题,其中Sonar启动并在几分钟内使用了多达12个db的连接。打开任何后续数据库连接以加载仪表板或执行API查询,sonarqube未关闭先前打开的会话。由于这些连接被放弃并且堆积起来,最终我的池中的连接耗尽导致错误。
Error querying database. Cause: org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
The error may exist in org.sonar.core.source.db.SnapshotDataMapper
答案 2 :(得分:0)
未创建正在创建的任何数据库连接。对于代码分析,Rest API调用和仪表板呈现类型连接。
分析是在Jenkins每天工作一次时触发的。