Forum Stats

  • 3,768,739 Users
  • 2,252,843 Discussions


Concurrency exception

francois.loison Member Posts: 3
edited Jun 24, 2017 10:21PM in Berkeley DB Java Edition


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(

        at com.sleepycat.persist.impl.CollectionProxy$HashSetProxy.initializeProxy(

        at com.sleepycat.persist.impl.ProxiedFormat.writeObject(

        at com.sleepycat.persist.impl.RecordOutput.writeObject(

        at com.sleepycat.persist.impl.ReflectionAccessor$ObjectAccess.write(

        at com.sleepycat.persist.impl.ReflectionAccessor.writeNonKeyFields(

        at com.sleepycat.persist.impl.ComplexFormat.writeObject(

        at com.sleepycat.persist.impl.PersistEntityBinding.writeEntity(

        at com.sleepycat.persist.impl.PersistEntityBinding.objectToDataInternal(

        at com.sleepycat.persist.impl.PersistEntityBinding.objectToData(

        at com.sleepycat.persist.PrimaryIndex.put(

Does somebody have a clue?

Thank you very much,



  • Greybird-Oracle
    Greybird-Oracle Member Posts: 2,690
    edited Jun 24, 2017 10:21PM


    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?


This discussion has been closed.