Upgrade of Bamboo failing with InterruptedException errors
Symptoms
Upgrading Bamboo using either the in-place database or export/import of the backup fail with the following errors appear in the atlassian-bamboo.logs
Caused by: java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1315)
at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
... 65 more
2012-08-30 15:27:18,706 INFO [1-UpgradeTaskBackgroundThread:pool-4-thread-1] [MultiThreadedUpgradeRunner] Throwing exception
2012-08-30 15:27:18,706 ERROR [1-UpgradeTaskBackgroundThread:pool-4-thread-1] [AbstractUpgradeManager]
...
com.atlassian.upgrade.UpgradeException: Unable to upgrade: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; An SQLException was provoked by the following failure: java.lang.InterruptedException; nested exception is java.sql.SQLException: An SQLException was provoked by the following failure: java.lang.InterruptedException
at com.atlassian.bamboo.upgrade.tasks.MultiThreadedUpgradeRunner.checkException(MultiThreadedUpgradeRunner.java:121)
at com.atlassian.bamboo.upgrade.tasks.MultiThreadedUpgradeRunner.waitForTermination(MultiThreadedUpgradeRunner.java:112)
at com.atlassian.bamboo.upgrade.tasks.UpgradeTask2025BuildChainConversion.doUpgrade(UpgradeTask2025BuildChainConversion.java:273)
at com.atlassian.bamboo.upgrade.AbstractUpgradeManager.runUpgradeTask(AbstractUpgradeManager.java:172)
at com.atlassian.bamboo.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:86)
at com.atlassian.bamboo.upgrade.UpgradeLauncher$1.call(UpgradeLauncher.java:115)
at com.atlassian.bamboo.upgrade.UpgradeLauncher$1.call(UpgradeLauncher.java:111)
...
Caused by: org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; An SQLException was provoked by the following failure: java.lang.InterruptedException; nested exception is java.sql.SQLException: An SQLException was provoked by the following failure: java.lang.InterruptedException
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:120)
at org.springframework.orm.hibernate.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:364)
at org.springframework.orm.hibernate.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:351)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:375)
at org.springframework.orm.hibernate.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:601)
at com.atlassian.hibernate.HibernateObjectDao.saveRaw(HibernateObjectDao.java:148)
at com.atlassian.hibernate.HibernateObjectDao.save(HibernateObjectDao.java:118)
at com.atlassian.bamboo.labels.LabelHibernateDao.saveLabelling(LabelHibernateDao.java:330)
Cause
This is because you might be having mulitple threads connecting, some of the c3P0 queries will then be in waiting mode(waiting for a connection to be available). If there is an interrupt() at that stage, the connection wait will be interrupted.
Resolution
You will need to increase the connection pool to at least 100, which is the recommended setting for the max number of concurrent connections to Bamboo database:
- Shutdown Bamboo
- Edit the $Bamboo_home/bamboo.cfg.xml file and set hibernate.c3p0.max_size to 100:
<property name="hibernate.c3p0.max_size">100</property>
- Restart Bamboo and do the upgrade again.