1 Reply Latest reply on Jun 25, 2017 2:21 AM by Greybird-Oracle

    Concurrency exception

    francois.loison

      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

        • 1. Re: Concurrency exception
          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