3 Replies Latest reply: Feb 22, 2008 8:27 AM by Greybird-Oracle RSS

    Transaction/Lock timeout ignored with isolation serializable?

    333524
      Hello

      I have the impression that when I use the isolation level 'serializable' transaction and lock timeouts are ignored. When I use the other levels, it works as expected.

      Here's some code:

      TransactionConfig txConfig = new TransactionConfig();
      txConfig.setSerializableIsolation(true);
      tx = dbEnv.beginTransaction(null, txConfig);

      tx.setLockTimeout(8000000);
      tx.setTxnTimeout(8000000);

      OperationStatus status = permissionDB.get(tx, sspKey, sspData, LockMode.DEFAULT);

      gives me this exception in a multithreaded environment:

      com.sleepycat.je.DeadlockException: (JE 3.2.68) Lock expired. Locker -1_ReaderThread 5_BuddyLocker: waited for lock on database=userDB node=24508 type=RANGE_INSERT grant=WAIT_NEW timeoutMillis=500 startTime=1203597218915 endTime=1203597219914
      Owners: [<LockInfo locker="7633_ReaderThread 6_Txn" type="RANGE_READ"/>, <LockInfo locker="7635_ReaderThread 8_Txn" type="RANGE_READ"/>, <LockInfo locker="7629_ReaderThread 3_Txn" type="RANGE_READ"/>, <LockInfo locker="7632_ReaderThread 5_Txn" type="RANGE_READ"/>, <LockInfo locker="7628_ReaderThread 2_Txn" type="RANGE_READ"/>, <LockInfo locker="7631_ReaderThread 0_Txn" type="RANGE_READ"/>, <LockInfo locker="7627_ReaderThread 1_Txn" type="RANGE_READ"/>, <LockInfo locker="7634_ReaderThread 7_Txn" type="RANGE_READ"/>, <LockInfo locker="7630_ReaderThread 4_Txn" type="RANGE_READ"/>, <LockInfo locker="7636_ReaderThread 9_Txn" type="RANGE_READ"/>]
      Waiters: [<LockInfo locker="-1_ReaderThread 1_BuddyLocker" type="RANGE_INSERT"/>, <LockInfo locker="-1_ReaderThread 9_BuddyLocker" type="RANGE_INSERT"/>, <LockInfo locker="-1_ReaderThread 3_BuddyLocker" type="RANGE_INSERT"/>]

           at ch.swisslife.security.sphinx.internal.bdbcache.SphinxRepositoryCache.doesUserHavePermission(SphinxRepositoryCache.java:295)
           at ch.swisslife.security.test.sphinx.internal.bdbcache.SphinxRepositoryCacheStressTest$ReaderRunnable.run(SphinxRepositoryCacheStressTest.java:119)
           at java.lang.Thread.run(Thread.java:534)

      As you can see, 500ms is used as lock timeout, not the 8000ms as I set them.

      Am I doing something wrong or is this intended behaviour?

      Regards, Leo
        • 1. Re: Transaction/Lock timeout ignored with isolation serializable?
          Greybird-Oracle
          Hello Leo,

          This looks like a bug in JE -- thanks for reporting it! I'm still investigating, but it looks like a bug that impacts both the Serializable and ReadCommitted isolation modes. We'll fix this.

          In the mean time, you can work around this problem by setting the timeouts for the entire environment using the EnvironmentConfig.setLockTimeout and setTxnTimeout methods. Will this work for you? Or do you need different timeout values for different transactions?

          --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
          • 2. Re: Transaction/Lock timeout ignored with isolation serializable?
            333524
            Hello Mark

            You're welcome!

            Yes, the workaround works fine, thanks.

            By the way: do you have some release-roadmap published (when are the next patches/releases planned)?

            Regards, Leo
            • 3. Re: Transaction/Lock timeout ignored with isolation serializable?
              Greybird-Oracle
              Hello Mark

              You're welcome!

              Yes, the workaround works fine, thanks.
              Good to hear!
              By the way: do you have some release-roadmap
              published (when are the next patches/releases
              planned)?
              No, unfortunately. Like in many large companies, our lawyers and accountants won't allow us to do that. BDB is available under a commercial license as well as an open-source license.

              --mark