The application has 8 threads opening and closing connections to hundreds of HSQLDB databases. The application is running with the 2.2.9 hsqldb.jar.
java.lang.ArrayIndexOutOfBoundsException: -1 at org.hsqldb.store.BaseHashMap$BaseHashIterator.next(Unknown Source) at org.hsqldb.DatabaseManager.getDatabaseObject(Unknown Source) at org.hsqldb.DatabaseManager.getDatabase(Unknown Source) at org.hsqldb.DatabaseManager.newSession(Unknown Source) at org.hsqldb.jdbc.JDBCConnection.<init>(Unknown Source) at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source) at org.hsqldb.jdbc.JDBCDriver.connect(Unknown Source) at java.sql.DriverManager.getConnection(DriverManager.java:615) at java.sql.DriverManager.getConnection(DriverManager.java:167) at org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:78) at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582) at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1181) at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
I suspect the issue is that the fileDatabaseMap isn't synchronized consistently.
In addDatabaseObject, getDatabaseObject, and lookupDatabaseObject, the synchronization is on the DatabaseManager class. In removeDatabase, it's on the map.
I glanced at the 2.3.2 code and it didn't seem to differ here.
Thanks.
The current synchronization arrangement cannot be changed due to possible deadlock, or alternatively long waits when multiple databases are used.
Could it use a ConcurrentHashMap?
Any possibility of movement on this? we occassionally hit this as well under high loads.
Hi James, I will review the code in the coming months.
any progress on this?
I will try to review and fix for version 2.4.1
I have made all access to the maps synchronized. Please run your test and report.