1 Reply Latest reply on Feb 15, 2019 1:05 PM by 940250

    A creation of ReplicatedEnvironment can hang on initialization of TupleBinding/IntegerBinding when another instance of non replicated environment invokes a static method on IntegerBinding in parallel thread

    940250

      Hi,

       

      When 2 BDB JE environments (one replicated and another non-replicated) co-exist in the same JVM, the creation of replicated environment can hang occasionally.

       

      The BDB JE environments are create in parallel threads.The issue was reported couple of times to me. A thread-dump was collected last time.

      In the thread dump I could see that hanging happened on initialization of class "com.sleepycat.bind.tuple.TupleBinding" as below:

      at com.sleepycat.bind.tuple.TupleBinding.<clinit>(TupleBinding.java:53)

          at com.sleepycat.je.cleaner.ExpirationProfile.populateCache(ExpirationProfile.java:193)

          -  locked java.util.HashMap@56d1b799

          at com.sleepycat.je.recovery.RecoveryManager.recover(RecoveryManager.java:434)

          at com.sleepycat.je.dbi.EnvironmentImpl.finishInit(EnvironmentImpl.java:841)

          -  locked com.sleepycat.je.rep.impl.RepImpl@57b9bac8

          at com.sleepycat.je.dbi.DbEnvPool.getEnvironment(DbEnvPool.java:222)

          at com.sleepycat.je.Environment.makeEnvironmentImpl(Environment.java:267)

          at com.sleepycat.je.Environment.<init>(Environment.java:252)

          at com.sleepycat.je.rep.ReplicatedEnvironment.<init>(ReplicatedEnvironment.java:607)

          at com.sleepycat.je.rep.ReplicatedEnvironment.<init>(ReplicatedEnvironment.java:466)

          at com.sleepycat.je.rep.ReplicatedEnvironment.<init>(ReplicatedEnvironment.java:540)

       

      At line 53 of TupleBinding an instance of IntegerBindin is created and added into HashMap:

              addPrimitive(Integer.class, Integer.TYPE, new IntegerBinding());

       

      The other non-replicated environment instance was successfully created, however, the hung for this environment happened at the same time on invocation of BDB JE static method IntegerBinding.entryToInt(key).

       

      The code where hanging happened looks like the one below

       

        DatabaseEntry key = new DatabaseEntry();

        DatabaseEntry value = new DatabaseEntry();

       

        while(cursor.getNext(key, value, null) == OperationStatus.SUCCESS)

        {

            int i = IntegerBinding.entryToInt(key); // <!--- hang at this line

      ...

      It looks like a bizarre classloader issue to me. Perhaps, it would be better to raise a defect against JDK, but, before taking that route, I would like to clarify, whether anyone else experienced something similar. If so, is there is any way to work around it?

       

      Th bdb je version in use is 7.4.5.

       

      Here are some details of environments where issues happened.

      JVM: Oracle Corporation, version: 1.8.0_144-b01, OS: Linux version: 2.6.18-423.el5, architecture: amd64, cores: 64

      JVM: Oracle Corporation, version: 1.8.0_161-b12, OS: Linux version: 3.10.0-514.6.1.el7.x86_64, architecture: amd64, cores: 40

       

      Please note that the reported issue occurs on application startup. The JVMs seem were not in any stress...

       

      Kind Regards,

      Alex