Skip to Main Content

Berkeley DB Family

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Concurrency exception

francois.loisonJun 24 2017 — edited Jun 24 2017

Hello,

My application is multi-threaded and writes concurrently entries.

Sometimes, method PrimaryIndex.put() crashes:

Caused by: java.lang.ArrayIndexOutOfBoundsException: 1

        at com.sleepycat.persist.impl.CollectionProxy.initializeProxy(CollectionProxy.java:48)

        at com.sleepycat.persist.impl.CollectionProxy$HashSetProxy.initializeProxy(CollectionProxy.java:83)

        at com.sleepycat.persist.impl.ProxiedFormat.writeObject(ProxiedFormat.java:137)

        at com.sleepycat.persist.impl.RecordOutput.writeObject(RecordOutput.java:116)

        at com.sleepycat.persist.impl.ReflectionAccessor$ObjectAccess.write(ReflectionAccessor.java:441)

        at com.sleepycat.persist.impl.ReflectionAccessor.writeNonKeyFields(ReflectionAccessor.java:278)

        at com.sleepycat.persist.impl.ComplexFormat.writeObject(ComplexFormat.java:604)

        at com.sleepycat.persist.impl.PersistEntityBinding.writeEntity(PersistEntityBinding.java:219)

        at com.sleepycat.persist.impl.PersistEntityBinding.objectToDataInternal(PersistEntityBinding.java:197)

        at com.sleepycat.persist.impl.PersistEntityBinding.objectToData(PersistEntityBinding.java:175)

        at com.sleepycat.persist.PrimaryIndex.put(PrimaryIndex.java:404)

Does somebody have a clue?

Thank you very much,

François

Comments

Greybird-Oracle

Hello,

From the stack trace, it looks like you have a field of type HashSet that is persistent, and the HashSet is being changed in one thread of your app, and written (PrimaryIndex.put) by another thread in your app.  In other words, one HashSet instance, or the entity object that contains it, is being accessed by multiple threads, and one thread is changing it while another is reading it.

Note that this has nothing to do with database access or record locking. It only involves access to the HashSet (or entity object) instance. Normally, entity objects are not shared between threads. Are you sharing them explicitly between threads?

--mark

1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jul 22 2017
Added on Jun 24 2017
1 comment
377 views