Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-3573

Livelock in PseudoClockScheduler

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.18.0.Final
    • 7.17.0.Final
    • core engine
    • None

      When running test with pseudo clock and fireUntilHalt, it could end up in a livelock, where a while loop never ends [1]. The main problem in [1] is the isCancel() if statement. Current synchronization doesn't block cancelling the item during ongoing runCallBacksAndIncreaseTimer method call with [2]. That causes a livelock, because new item is not read in the loop, therefore it iterates over the same item again and again. This can be tested by running CepEspTest.testEventExpirationInSlidingWindow [3] more times in a row till it fails (it always fails after some time).

      I will create a PR for this.

      [1] https://github.com/kiegroup/drools/blob/04d58e7714844e73f68e6143e235bb55791c9888/drools-core/src/main/java/org/drools/core/time/impl/PseudoClockScheduler.java#L204
      [2] https://github.com/kiegroup/drools/blob/04d58e7714844e73f68e6143e235bb55791c9888/drools-core/src/main/java/org/drools/core/time/impl/PseudoClockScheduler.java#L147
      [3] https://github.com/kiegroup/drools/blob/2bf3c13de000864e7c45b9fd008af2f542674592/drools-test-coverage/test-compiler-integration/src/test/java/org/drools/compiler/integrationtests/CepEspTest.java#L1933

              tzimanyi@redhat.com Tibor Zimányi
              tzimanyi@redhat.com Tibor Zimányi
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: