Uploaded image for project: 'JBoss ESB'
  1. JBoss ESB
  2. JBESB-3397

halt()/dispose() race condition in DroolsRuleBaseState

    Details

    • Estimated Difficulty:
      Medium

      Description

      What happens:
      Thread 1 creates a stateful session and spawns daemon Thread 2 (with the correct TCCL).
      Thread 2 calls fireUntilHalt() on the stateful session, which suspends that Thread.
      Thread 3 calls halt() on the stateful session, which will cause Thread 2 to stop once all the rules have finished firing, however returns immediately.
      Thread 3 calls dispose() on the stateful session, but the rules might not have finished firing. This could cause unpredictable results.

      What needs to happen:
      Thread 1 creates a stateful session and spawns daemon Thread 2 (with the correct TCCL).
      Thread 2 calls fireUntilHalt() on the stateful session, which suspends that Thread.
      Thread 3 calls halt() on the stateful session, which will cause Thread 2 to stop once all the rules have finished firing, however returns immediately.
      Thread 3 calls join() on Thread 2, which will return once all the rules have finished firing and Thread 2 is done.
      Thread 3 calls dispose() on the stateful session safely, as now the rules have finished firing. This means predictable results.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                dward David Ward
                Reporter:
                dward David Ward
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: