castor
  1. castor
  2. CASTOR-3109

Eliminate the synchronized on basemolder in in LockEngine.load()

    Details

    • Type: Improvement Improvement
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3.2
    • Fix Version/s: 1.3.3rc1
    • Component/s: JDO
    • Labels:
      None
    • Number of attachments :
      1

      Description

      Let's assume an entity B which extends another entity A. In such a scenario for LockEngine.load, we need release and reaquire lock as well as removal and reassociation of entity with TransactionContext as this causes deadlocks.

        Activity

        Hide
        Wensheng Dou added a comment -

        Change the oid's meaning, and make it unique for one instance. Then one instance just has one oid, and just one lock (no matter extended or not).

        Show
        Wensheng Dou added a comment - Change the oid's meaning, and make it unique for one instance. Then one instance just has one oid, and just one lock (no matter extended or not).
        Hide
        Ralf Joachim added a comment -

        Hi Wensheng, after our discussion on IRC last Wednesday I managed to reproduce the problems we have with the synchronized block in LockEngine.load(). I did this without applying your patch. The cpactf tests where you can see the issues are 'test04' and 'test2861'.

        With synchronization:

        • test04 blocks forever
        • test2861 works as expected

        Without synchronization (just commented out sync on basemolder):

        • test04 works as expected
        • test2861 fails

        Will test what happens with your patch next.

        Show
        Ralf Joachim added a comment - Hi Wensheng, after our discussion on IRC last Wednesday I managed to reproduce the problems we have with the synchronized block in LockEngine.load(). I did this without applying your patch. The cpactf tests where you can see the issues are 'test04' and 'test2861'. With synchronization: test04 blocks forever test2861 works as expected Without synchronization (just commented out sync on basemolder): test04 works as expected test2861 fails Will test what happens with your patch next.
        Hide
        Ralf Joachim added a comment - - edited

        With patch applied:

        • test04 throws a NullPointerException. This happens as the expected LockNotGrantedException is catched in AbstractTransactionContext.load() to unregister the object that was to be loaded from transaction context.
        • test2861 works as expected

        I think the patch goes into the right direction with regard to:

        • change of OID meaning
        • exchange of locking/tracking sequence (before the patch object first gets tracked and then locked / with patch object gets locked first and tracked thereafter)

        If possible i would like these 2 refactorings to be isolated in different patches (OID change first).

        Show
        Ralf Joachim added a comment - - edited With patch applied: test04 throws a NullPointerException. This happens as the expected LockNotGrantedException is catched in AbstractTransactionContext.load() to unregister the object that was to be loaded from transaction context. test2861 works as expected I think the patch goes into the right direction with regard to: change of OID meaning exchange of locking/tracking sequence (before the patch object first gets tracked and then locked / with patch object gets locked first and tracked thereafter) If possible i would like these 2 refactorings to be isolated in different patches (OID change first).
        Hide
        Ralf Joachim added a comment -

        With regard to the work done through subtasks its about time to resolve this as fixed.

        Show
        Ralf Joachim added a comment - With regard to the work done through subtasks its about time to resolve this as fixed.

          People

          • Assignee:
            Wensheng Dou
            Reporter:
            Wensheng Dou
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: