Database lock acquisition failure

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Database lock acquisition failure

Mike Ressler-2
Folks,

I didn't have as much luck debugging this one.  I'm surprised that the transaction is requesting a new connection.  I have the database in embedded mode if it makes a difference.

Is it up to the hsqldb.JDBCDriver to reuse existing connections?  Any chance the driver could block until the lock becomes free?  Any chance I can set the locking strategy to be more granular than the whole database?  Any other suggestions for avoiding this error?

I reproduce it when sending too many requests to my web app.

org.hsqldb.HsqlException: Database lock acquisition failure: attempt to connect while db opening /closing
    at org.hsqldb.Error.error(Error.java:76)
    at org.hsqldb.Error.error(Error.java:117)
    at org.hsqldb.DatabaseManager.getDatabase(DatabaseManager.java:238)
    at org.hsqldb.DatabaseManager.newSession(DatabaseManager.java:145)
    at org.hsqldb.jdbc.JDBCConnection.<init>(JDBCConnection.java:3219)
    at org.hsqldb.jdbc.JDBCDriver.getConnection(JDBCDriver.java:285)
    at org.hsqldb.jdbc.JDBCDriver.connect(JDBCDriver.java:245)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:154)
    at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:173)
    at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:164)
    at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:149)
    at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:119)
    at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82)
    at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
    at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
    at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)
    at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
    at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1353)
    at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:555)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:264)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

Thanks!

Mike Ressler

------------------------------------------------------------------------------

_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database lock acquisition failure

Fred Toussi-2
Which version of HSQLDB is this?
 
This can happen if the shutdown=true property is used on the connections to the database, or the application shuts down the database deliberately. Otherwise, once the first connection has been made (and even closed), the database remains open and there is no way subsequent connections attempt to open the database again.
 
You can use the app log to monitor the opening / closing of the database. For, version 1.8.0 see the changelist on how to enable this.
 
Fred
 
On Thu, 23 Jul 2009 20:27 -0400, "Mike Ressler" <[hidden email]> wrote:
Folks,

I didn't have as much luck debugging this one.  I'm surprised that the transaction is requesting a new connection.  I have the database in embedded mode if it makes a difference.

Is it up to the hsqldb.JDBCDriver to reuse existing connections?  Any chance the driver could block until the lock becomes free?  Any chance I can set the locking strategy to be more granular than the whole database?  Any other suggestions for avoiding this error?

I reproduce it when sending too many requests to my web app.

orghsqldb.HsqlException: Database lock acquisition failure: attempt to connect while db opening /closing
    at org.hsqldb.Error.error(Error.java:76)
    at org.hsqldb.Error.error(Error.java:117)
    at org.hsqldb.DatabaseManager.getDatabase(DatabaseManager.java:238)
    at org.hsqldb.DatabaseManager.newSession(DatabaseManager.java:145)
    at org.hsqldb.jdbc.JDBCConnection.<init>(JDBCConnection.java:3219)
    at org.hsqldb.jdbc.JDBCDriver.getConnection(JDBCDriver.java:285)
    at org.hsqldb.jdbc.JDBCDriver.connect(JDBCDriver.java:245)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:154)
    at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:173)
    at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:164)
    at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:149)
    at org.springframework.jdbc.datasource.AbstractDriverBasedDataSourcegetConnection(AbstractDriverBasedDataSource.java:119)
    at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82)
    at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
    at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
    at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)
    at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
    at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1353)
    at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:555)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:264)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)

Thanks!

Mike Ressler

------------------------------------------------------------------------------

_______________________________________________
Hsqldb-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database lock acquisition failure

ChrisShoff
This post has NOT been accepted by the mailing list yet.
Just wanted to comment that I was facing a very similar issue here. I had a series of integration tests that were failing after the first test with a database lock acquisition failure. Adding shutdown=true to my connection URL seems to have resolved the issue. The plot twist is that the OP is my current CEO. So, thanks for hitting this problem first, 4-Years-Ago-Mike. See you tomorrow.
Loading...