Details

      Description

      LockLocalServiceTest produces DB level unique constrain violation if two threads (or more than one node of a cluster) tries to acquire the same lock nearly at the same time.

      T1: Fetch lock           T2: Fetch lock
      T1: No data found
                               T2: No data found
      T1: Create new lock      
                               T2: Create new lock
      

      Steps to reproduce: Execute the pertinent test case (LockLocalServiceTest).

      $ git branch | grep "^*"
      * ee-6.1.20
      $ ant test-class -Dclass=LockLocalServiceTest
      ...
      [junit] 13:12:48,891 ERROR [pool-1-thread-3][JDBCExceptionReporter:76] Cannot insert duplicate key row in object 'dbo.Lock_' with unique index 'IX_DD635956'. The duplicate key value is (className, key, owner).
      [junit] 13:12:48,896 ERROR [pool-1-thread-6][JDBCExceptionReporter:76] Cannot insert duplicate key row in object 'dbo.Lock_' with unique index 'IX_DD635956'. The duplicate key value is (className, key, owner).
      ...
      [junit] Test com.liferay.portal.service.LockLocalServiceTest FAILED
      

      Unfortunately LockLocalService does not work well under the aforementioned race condition on trunk either and produces unique constraint violation on almost every RDBMS (except MySQL):

      • MySQL -> Deadlock
      • SQL Server -> Cannot insert duplicate key row in object 'dbo.Lock' with unique index 'IX_DD635956'._
      • DB2 -> SQL0803N
      • Oracle -> ORA-00001: unique constraint (LPORTAL_6200.IX_DD635956) violated.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                laszlo.csontos Laszlo Csontos (Inactive)
                Reporter:
                laszlo.csontos Laszlo Csontos (Inactive)
                Participants of an Issue:
                Recent user:
                Esther Sanz
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  4 years, 40 weeks ago