591 words

Issue #121 - ArrayIndexOutOfBoundsException: -1

BugVersion: Priority: CriticalStatus: FixedReplies: 3
#1
2011-12-27 14:20

I've attached a test which fails with the error "ArrayIndexOutOfBoundsException: -1". It runs 10 threads which create and persist objects. The objects are based on application objects so its not a single class test I'm afraid but it is standalone. I'm running as follows: java -classpath objectdb.jar;test.jar PersistTest

I've attached the test jar, a jar containing the source and the odjectdb.conf.

Unfortunately the problem occurs inconsistently - sometimes it will fail almost immediately, sometimes it will run for a couple of minutes - so is most likely connected to the multiple threads. I haven't been able to narrow it down further so I'm hoping you see the same behaviour from the example.

I'm running with 64bit JVM 1.6.0_30 on windows 7

The first thread to fail output the following stacktrace:

java.lang.ArrayIndexOutOfBoundsException: -1
        at com.objectdb.o.HTB.t(HTB.java:448)
        at com.objectdb.o.PGC.B(PGC.java:403)
        at com.objectdb.o.SFL.ah(SFL.java:991)
        at com.objectdb.o.SFL.run(SFL.java:899)
        at java.lang.Thread.run(Unknown Source)

Subsequent threads fail with the followin stacktrace:

[ObjectDB 2.3.5_04] javax.persistence.PersistenceException
Attempt to commit a transaction after failure in writing to database file 'C:\Users\Home\workspace\Object.Test\test\persistTest.odb' (error 144)
        at PersistTest$ErrorThread.run(PersistTest.java:97)
Caused by: com.objectdb.o.UserException: Attempt to commit a transaction after failure in writing to database file 'C:\Users\Home\workspace\Object.Test\test\persistTest.odb'
        at com.objectdb.o.MSG.d(MSG.java:74)
        at com.objectdb.o.SFL.ad(SFL.java:823)
        at com.objectdb.o.MST.ad(MST.java:1327)
        at com.objectdb.o.MST.Va(MST.java:1230)
        at com.objectdb.o.WRA.Va(WRA.java:355)
        at com.objectdb.o.WSM.Va(WSM.java:146)
        at com.objectdb.o.OBM.bK(OBM.java:945)
        at com.objectdb.o.OBM.bH(OBM.java:818)
        at com.objectdb.o.OBM.flush(OBM.java:739)
        ... 1 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
        at com.objectdb.o.HTB.t(HTB.java:448)
        at com.objectdb.o.PGC.B(PGC.java:403)
        at com.objectdb.o.SFL.ah(SFL.java:991)
        at com.objectdb.o.SFL.run(SFL.java:899)
        at java.lang.Thread.run(Unknown Source)

Please let me know if you need any further information.

 

thumbripper
thumbripper's picture
Joined on 2011-06-18
User Post #5
#2
2011-12-31 16:04

Thank you very much for this useful test.

It also reproduces other exceptions that have been reported by you (issues #116, #119).

Please try build 2.3.5_05 that should fix all these issues.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #834
#3
2012-01-03 10:25

Great - thanks.

Do you have any more detail on the specifics of the problem? I'm keen to make my test more robust and target the issue directly if possible.

felixobjectdb
felixobjectdb's picture
Joined on 2011-02-10
User Post #100
#4
2012-01-03 10:53

It was a bug in the page cache.

This cache can hold several different versions of the same database page (representing pages that were modified by different transactions) and it should serve the right version of every page for every user (depending when the operation has started). You cannot disable that cache since it has a minimum size even if you request zero size.

In some situations (e.g. when using flush that is followed by other operations and then commit) - the page cache could purge newer version of a page leaving older versions for use by newer users. The result is catastrophic, since a new transaction may commit mixed old and new pages. Therefore it could corrupt the database, as demonstrated by your test. Consequently many types of unexpected exceptions (including ArrayIndexOutBoundsException) can be thrown.

The ObjectDB storage engine (including the page cache) is tested with 100% line coverage, but apparently this is not sufficient, since these tests do not cover all the possible scenarios, as your test showed.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #838

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel