jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Sonar
  • SONAR-188

Error to get a connection from the database

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.1
  • Fix Version/s: 1.3
  • Component/s: Database
  • Labels:
    None
  • Environment:
    Red Hat AS 4 with a mySql 5

Description

I started my sonar server 5 days ago and I had an error to get a connection from the database

A release connection might be forgiven in your code somewhere.

This is my log.

2008.03.14 15:33:44 ERROR c.h.s.c.b.DatabaseTask - Error with database
org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:104)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at ch.hortis.sonar.jpa.Persistence.databaseExists(Persistence.java:80)
at ch.hortis.sonar.core.batch.DatabaseTask.checkDatabase(DatabaseTask.java:61)
at ch.hortis.sonar.core.batch.DatabaseTask.run(DatabaseTask.java:72)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:825)
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
... 13 common frames omitted
2008.03.14 15:33:49 ERROR c.h.s.c.b.DatabaseTask - Error with database
org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:104)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at ch.hortis.sonar.jpa.Persistence.databaseExists(Persistence.java:80)
at ch.hortis.sonar.core.batch.DatabaseTask.checkDatabase(DatabaseTask.java:61)
at ch.hortis.sonar.core.batch.DatabaseTask.run(DatabaseTask.java:72)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:825)
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
... 13 common frames omitted
org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:104)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at ch.hortis.sonar.jpa.Persistence.databaseExists(Persistence.java:80)
at ch.hortis.sonar.core.batch.DatabaseTask.checkDatabase(DatabaseTask.java:61)
at ch.hortis.sonar.core.batch.DatabaseTask.run(DatabaseTask.java:72)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:825)
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
... 13 common frames omitted
2008.03.14 15:33:59 ERROR c.h.s.c.b.DatabaseTask - Error with database
org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:104)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at ch.hortis.sonar.jpa.Persistence.databaseExists(Persistence.java:80)
at ch.hortis.sonar.core.batch.DatabaseTask.checkDatabase(DatabaseTask.java:61)
at ch.hortis.sonar.core.batch.DatabaseTask.run(DatabaseTask.java:72)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:825)
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
... 13 common frames omitted

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Simon Brandhof added a comment - 26/Mar/08 4:35 AM

Can not reproduce, postponed to 1.3 release

Show
Simon Brandhof added a comment - 26/Mar/08 4:35 AM Can not reproduce, postponed to 1.3 release
Hide
Permalink
Pascal Thivent added a comment - 28/Mar/08 12:56 PM

Hello,

I reported on the mailing list that I faced the same problem with sonar-1.1 after 11 days of usage. The sonar server is running on a solaris box (machine A) and uses a mysql database hosted on the same machine. The maven sonar plugin runs on a CI server on another machine (machine B).

The environment of machine A is :

$ uname -a

SunOS tips 5.10 Generic_118855-33 i86pc i386 i86pc

$ mysql -v

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 55651

Server version: 5.0.51 Source distribution

$ java -version

java version "1.5.0_07"

I didn't look at the code but my guess is that the problem is not located on the webapp side but in the code involved by the plugin (i.e. when collecting and writing data). In my case, the first error in the wrapper.log raised during the collect. Not being able to use the web interface because the pool ran out of connections was just a consequence.

Let me know if you need more details.

Pascal

Show
Pascal Thivent added a comment - 28/Mar/08 12:56 PM Hello, I reported on the mailing list that I faced the same problem with sonar-1.1 after 11 days of usage. The sonar server is running on a solaris box (machine A) and uses a mysql database hosted on the same machine. The maven sonar plugin runs on a CI server on another machine (machine B). The environment of machine A is : $ uname -a SunOS tips 5.10 Generic_118855-33 i86pc i386 i86pc $ mysql -v Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 55651 Server version: 5.0.51 Source distribution $ java -version java version "1.5.0_07" I didn't look at the code but my guess is that the problem is not located on the webapp side but in the code involved by the plugin (i.e. when collecting and writing data). In my case, the first error in the wrapper.log raised during the collect. Not being able to use the web interface because the pool ran out of connections was just a consequence. Let me know if you need more details. Pascal
Hide
Permalink
Alexandre Navarro added a comment - 24/Apr/08 4:48 AM

I think the problem comes from the mysql jdbc driver. The driver can not recover a connection after a long time of unuse. It is a classic problem (I remember to have the problem 3 years ago on a project).

I added the option autoReconnect=true at the end of the jdbc url :

jdbc:mysql://localhost:3306/sonar?autoReconnect=true

and now I do not have the problem.

Add this option by default in your configuration file.

Alexandre

PS : Pascal, can you test it and say us if it works on your project?

Show
Alexandre Navarro added a comment - 24/Apr/08 4:48 AM I think the problem comes from the mysql jdbc driver. The driver can not recover a connection after a long time of unuse. It is a classic problem (I remember to have the problem 3 years ago on a project). I added the option autoReconnect=true at the end of the jdbc url : jdbc:mysql://localhost:3306/sonar?autoReconnect=true and now I do not have the problem. Add this option by default in your configuration file. Alexandre PS : Pascal, can you test it and say us if it works on your project?
Hide
Permalink
Simon Brandhof added a comment - 16/May/08 6:48 AM

Done, thanks Alexandre.

Show
Simon Brandhof added a comment - 16/May/08 6:48 AM Done, thanks Alexandre.

People

  • Assignee:
    Cédric Munger
    Reporter:
    Alexandre Navarro
Vote (3)
Watch (1)

Dates

  • Created:
    14/Mar/08 9:51 AM
    Updated:
    27/May/08 7:33 AM
    Resolved:
    16/May/08 6:48 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.