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

CCE during fact insertion when two instances of a KieSession are obtained for the same KieModule

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 6.0.0.CR1
    • None
    • None
    • None

    Description

      Description of problem:

      When creating two instances of the same KieSession from KieContainer instances obtained for the same ReleaseId, a CCE occurs during insertion of the facts into the second KieSession instance.

      If you swap the KieSessions used in the test, the problem arises every time in the second KieSession evaluating the rules. The problem shows up also when using KieModule defining two KieSessions for one KieBase.

      When constructing the KieModule every time from scratch, the problem does not occur. The problem also does not occur when using the same instance of KieContainer for creating both KieSessions.

      The ClassCastException refers to classes generated for facts defined in DRL.

      Version-Release number of selected component (if applicable):

      BRMS 6.0.0.DR4
      Drools 6.0.0-SNAPSHOT

      How reproducible:

      I will attach a reference to PR with reproducer.

      The test scenario is as follows:

      1. create a KieModule with ReleaseId id defining one KieBase with one KieSession

      2. get a KieContainer from KieServices.newKieContainer(id) and obtain a KieSession from this KieContainer; insert test facts into this session, no problem occurs

      3. get another KieContainer from KieServices.newKieContainer(id) and obtain another KieSession from this KieContainer; try to insert test facts into this session, a ClassCastException occurs (see attachment for the full stacktrace):

      java.lang.ClassCastException: org.drools.compiler.integrationtests.Parent cannot be cast to org.drools.compiler.integrationtests.Parent
      at ConditionEvaluator1113e873a5ac4b8a98ffd475b0b5df68.evaluate(Unknown Source)
      at org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:212)
      at org.drools.core.rule.constraint.MvelConstraint.isAllowedCachedLeft(MvelConstraint.java:181)
      at org.drools.core.common.DoubleNonIndexSkipBetaConstraints.isAllowedCachedLeft(DoubleNonIndexSkipBetaConstraints.java:134)
      at org.drools.core.reteoo.JoinNode.propagateFromLeft(JoinNode.java:135)

      ....

      Please note that Parent is a class for fact defined in DRL. The exception happens during the insert operation (NamedEntryPoint.insert).

      Actual results:

      Inserting facts into the second KieSession throws a CCE.

      Expected results:

      Inserting facts works for both KieSessions.

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            mfusco@redhat.com Mario Fusco
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: