Menu

#1390 ArrayIndexOutOfBoundsException in org.hsqldb.DatabaseManager.getDatabaseObject

current-release
open-postponed
nobody
None
5
2018-02-26
2015-03-30
foss1024
No

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.

Discussion

  • Fred Toussi

    Fred Toussi - 2015-03-30
    • status: open --> open-postponed
     
  • Fred Toussi

    Fred Toussi - 2015-03-30

    The current synchronization arrangement cannot be changed due to possible deadlock, or alternatively long waits when multiple databases are used.

     
  • foss1024

    foss1024 - 2015-03-30

    Could it use a ConcurrentHashMap?

     
  • James Ahlborn

    James Ahlborn - 2017-09-19

    Any possibility of movement on this? we occassionally hit this as well under high loads.

     
  • Fred Toussi

    Fred Toussi - 2017-09-19

    Hi James, I will review the code in the coming months.

     
  • James Ahlborn

    James Ahlborn - 2018-02-23

    any progress on this?

     
  • Fred Toussi

    Fred Toussi - 2018-02-23

    I will try to review and fix for version 2.4.1

     
  • Fred Toussi

    Fred Toussi - 2018-02-26

    I have made all access to the maps synchronized. Please run your test and report.

     

Log in to post a comment.