Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1290 Bug in Transaction manager causing NPE

dev-tree(cvs&dev)
closed-fixed
Fred Toussi
engine (518)
1
2013-05-31
2013-03-22
Ognjen
No

Hi,
I discovered bug in newest snapshot (as of 18.03.2013 revision 5210 of trunk. We experience NPE in some cases of LOB usage.
NPE occurs when limit of 32 (or N * 32) is reached for size of rowAction.elementData.
Scenario is given in execution flow and solution patch (tested and works) is attached.
Please apply patch given or fix this bug in some different way in next release.

If we have lob column and we reach limit in element data following scenario occurs.

TransactionManagerCommon.adjustLobUsage(Session session) line 171 adjustLobUsageCount is called
SessionData.adjustLobUsageCount(TableBase table, Object[] data, int adjust) line 370 adjustUsageCount is called
LobManager.adjustUsageCount(Session session, long lobID, int delta) line 1750 execute is called
StatementDMQL.execute(Session session) line 196 getResult is called
StatementDML.getResult(Session session) line 197 executeUpdateStatement is called
StatementDML.executeUpdateStatement(Session session) line 550 updateAction is caled
StatementDML.update(Session session, Table table, RowSetNavigatorDataChange navigator, RowSetNavigator generatedNavigator) line 1053 addDeleteAction is called
Session.addDeleteAction(Table table, PersistentStore store, Row row, int[] colMap) line 429 delete action is added by transaction manager
TransactionManager2PL.addDeleteAction(Session session, Table table, PersistentStore store, Row row, int[] colMap) line 214 delete action is added
HSQLArrayList.add(Object element) line 154 call increaseCapacity because limit is reached
HSQLArrayList.increaseCapacity() line 267 call resize
HSQLArrayList.resize() line 284 array is cleared. In this way we clear array which is referred by line variable in adjustLobUsage method

In next iteration in TransactionManagerCommon.adjustLobUsage(Session session) we experieence Null pointer exception in line 156
if (action.type == RowActionBase.ACTION_NONE) {

Therefore we need to copy array instead of making reference to it.

Regards,
Ognjen Milic

Discussion

  • Ognjen
    Ognjen
    2013-03-22

    Patch for TransactionManagerCommon.java

     
  • Ognjen
    Ognjen
    2013-03-23

    Just to add instead of: TransactionManagerCommon

    line 147
    list = session.rowActionList.getArray()

    I implemented

    Object[] list = new Object[limit];

    System.arraycopy(session.rowActionList.getArray(), 0, list, 0, limit);

     
  • Fred Toussi
    Fred Toussi
    2013-03-25

    Thanks for clear reporting and fix.
    Fixed in a different way and committed to SVN.

     
  • Fred Toussi
    Fred Toussi
    2013-03-25

    • status: open --> open-fixed
     
  • Fred Toussi
    Fred Toussi
    2013-03-25

    • assigned_to: nobody --> fredt
     
  • Fred Toussi
    Fred Toussi
    2013-05-31

    • priority: 5 --> 1
    • status: open-fixed --> closed-fixed