Uploaded image for project: 'Alfresco'
  1. Alfresco
  2. ALF-22005

TransactionBehaviours and Rules in unsteady order


    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: Community Edition 201707 GA
    • Fix Version/s: None
    • Component/s: Repository
    • Security Level: external (External user)
    • Labels:
    • Triage:
      Won't Fix
    • Resolution Time Custom Field:
      4 days, 2 hours, 24 minutes, 51 seconds


      Short Description

      TransactionListener for the TransactionBehaviourQueue and RulesTransactionListener are executed in unsteady order.

      Long Description

      The TransactionListener in the org.alfresco.repo.policy.TransactionBehaviourQueue executes all TRANSACTION_COMMIT Behaviours before commiting the transaction. The RuleTransactionListener executes all Rules, that are triggered during the transaction.

      The TranscationListeners are executed in org.alfresco.util.transaction.TransactionSupportUtil$TransactionSynchronizationImpl#doBeforeCommit(Set, boolean) Method. This method stores them in a HashSet, so the sortOrder is not defined. Actually, depending on the hash, they are always executed in a different order. This is the failure in our case!

      If Behaviours are triggered, like createNode, in a rule, so the behaviours behave different. TRANSACTION_COMMIT-Behaviours are executed immediatly if the BehaviourQueue is flushed before. But this is not as expected. To use behaviours as intended, the pending Rules should be executed before flushing the BehaviourQueue. This has the effect, that TRANSACTION_COMMIT behaviours are delayed after all other behaviours.

      In our case the business logic is either failing or completing, depending on the nondeterministic sort-order.



      Always flush the BehaviourQueue after executing pending rules. TransactionListener should have a deterministic order.




          Issue Links



              • Assignee:
                closedissues Closed Issues
                JensKluttig Jens Kluttig
              • Votes:
                1 Vote for this issue
                4 Start watching this issue


                • Created:
                  Date of First Response: