Menu

Connection#rollback() throws EOFException with LOCAL TEMPORARY TABLE

Help
2018-02-21
2018-02-28
  • Kohei Nozaki

    Kohei Nozaki - 2018-02-21

    (I'm sorry, I posted this to the Open Discussion forum by a mistake and I don't know how to delete the topic there... please delete the previous one if you can...)

    Hello,

    I use HSQLDB 2.4.0 and am getting some Exceptions (EOFException and NullPointerException) when Connection#rollback() (or close) is invoked. Conditions which make this issue occur seem to be something like this:

    • A local temporary table is used
    • The number of total rows in the table is greater than the number of hsqldb.result_max_memory_rows

    I have created a simple reproducer and pushed it to my public GitHub repository. It can be run with mvn clean test: https://github.com/lbtc-xxx/hsqldbnpe . The code is here

    Could you please take a look at this problem and tell me a workaround if there is one? HSQLDB works great other than this problem. thank you. The exceptions which I'm getting are something like this:

    2018-02-21T19:56:45.238+0900  WARNING  failed to read a byte array
    java.io.EOFException
        at org.hsqldb.persist.RAFile.read(Unknown Source)
        at org.hsqldb.persist.RAFile.readInt(Unknown Source)
        at org.hsqldb.persist.DataFileCache.readObject(Unknown Source)
        at org.hsqldb.persist.DataFileCache.getFromFile(Unknown Source)
        at org.hsqldb.persist.DataFileCache.get(Unknown Source)
        at org.hsqldb.persist.RowStoreAVLHybrid.get(Unknown Source)
        at org.hsqldb.index.NodeAVLDisk.findNode(Unknown Source)
        at org.hsqldb.index.NodeAVLDisk.getRight(Unknown Source)
        at org.hsqldb.index.IndexAVL.findNode(Unknown Source)
        at org.hsqldb.index.IndexAVL.findFirstRow(Unknown Source)
        at org.hsqldb.Table.getDeleteRowFromLog(Unknown Source)
        at org.hsqldb.persist.RowStoreAVLHybridExtended.delete(Unknown Source)
        at org.hsqldb.persist.RowStoreAVLHybrid.rollbackRow(Unknown Source)
        at org.hsqldb.TransactionManager2PL.rollbackPartial(Unknown Source)
        at org.hsqldb.TransactionManager2PL.rollback(Unknown Source)
        at org.hsqldb.Session.rollbackNoCheck(Unknown Source)
        at org.hsqldb.Session.rollback(Unknown Source)
        at org.hsqldb.Session.close(Unknown Source)
        at org.hsqldb.jdbc.JDBCConnection.close(Unknown Source)
        at repro.MyTest2.name(MyTest2.java:44)
    
        ...
    
        java.lang.NullPointerException
        at org.hsqldb.persist.DataFileCache.get(Unknown Source)
        at org.hsqldb.persist.RowStoreAVLHybrid.get(Unknown Source)
        at org.hsqldb.persist.RowStoreAVLHybrid.getAccessor(Unknown Source)
        at org.hsqldb.persist.RowStoreAVLHybridExtended.getAccessor(Unknown Source)
        at org.hsqldb.index.IndexAVL.getAccessor(Unknown Source)
        at org.hsqldb.index.IndexAVL.findNode(Unknown Source)
        at org.hsqldb.index.IndexAVL.findFirstRow(Unknown Source)
        at org.hsqldb.Table.getDeleteRowFromLog(Unknown Source)
        at org.hsqldb.persist.RowStoreAVLHybridExtended.delete(Unknown Source)
        at org.hsqldb.persist.RowStoreAVLHybrid.rollbackRow(Unknown Source)
        at org.hsqldb.TransactionManager2PL.rollbackPartial(Unknown Source)
        at org.hsqldb.TransactionManager2PL.rollback(Unknown Source)
        at org.hsqldb.Session.rollbackNoCheck(Unknown Source)
        at org.hsqldb.Session.rollback(Unknown Source)
        at org.hsqldb.jdbc.JDBCConnection.rollback(Unknown Source)
    
     
  • Fred Toussi

    Fred Toussi - 2018-02-21

    Please check with the snaphot jar for version 2.4.1 available at http://hsqldb.org and report the result.

     
  • Kohei Nozaki

    Kohei Nozaki - 2018-02-21

    Hello, thank you for your prompt response.

    I've tried http://hsqldb.org/download/hsqldb.jar with the same test case but unfortunately I'm getting almost the same result. Is there any workaround? One of the exceptions which I've just got:

    closeConnectionThrowsSoManyExceptions(hsqldbinvestigation.ReproducerTest)  Time elapsed: 0.35 sec  <<< ERROR!
    java.lang.NullPointerException
            at org.hsqldb.persist.DataFileCache.get(Unknown Source)
            at org.hsqldb.persist.RowStoreAVLHybrid.get(Unknown Source)
            at org.hsqldb.persist.RowStoreAVLHybrid.getAccessor(Unknown Source)
            at org.hsqldb.persist.RowStoreAVLHybridExtended.getAccessor(Unknown Source)
            at org.hsqldb.index.IndexAVL.getAccessor(Unknown Source)
            at org.hsqldb.index.IndexAVL.findNode(Unknown Source)
            at org.hsqldb.index.IndexAVL.findFirstRow(Unknown Source)
            at org.hsqldb.Table.getDeleteRowFromLog(Unknown Source)
            at org.hsqldb.persist.RowStoreAVLHybridExtended.delete(Unknown Source)
            at org.hsqldb.persist.RowStoreAVLHybrid.rollbackRow(Unknown Source)
            at org.hsqldb.TransactionManager2PL.rollbackPartial(Unknown Source)
            at org.hsqldb.TransactionManager2PL.rollback(Unknown Source)
            at org.hsqldb.Session.rollbackNoCheck(Unknown Source)
            at org.hsqldb.Session.rollback(Unknown Source)
            at org.hsqldb.jdbc.JDBCConnection.rollback(Unknown Source)
            at hsqldbinvestigation.ReproducerTest.closeConnectionThrowsSoManyExceptions(ReproducerTest.java:45)
    ...
    
     
  • Fred Toussi

    Fred Toussi - 2018-02-21

    Thanks. I will check and fix the issue for the next version.

    The workaround for you now is to use the default hsqldb.result_max_memory_rows and avoid use of disk for temporary table data.

     
  • Kohei Nozaki

    Kohei Nozaki - 2018-02-22

    Thank you for your reply and the work you do. I wish I would be able to use the new version soon.

     
  • Fred Toussi

    Fred Toussi - 2018-02-26

    I have fixed the issue and committed the code. You can checkout from the SVN and test.

     
  • Kohei Nozaki

    Kohei Nozaki - 2018-02-28

    I've tried the SVN version and it seems to be fine. Thanks a lot!

     

Log in to post a comment.