Bug 965611 - ClassCastException during fact insertion when two instances of a KieSession are obtained for the same KieModule
Summary: ClassCastException during fact insertion when two instances of a KieSession a...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: BRE
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: DR4
: 6.0.0
Assignee: Mario Fusco
QA Contact: Marek Winkler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-05-21 12:08 UTC by Marek Winkler
Modified: 2014-08-06 20:19 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-08-06 20:19:59 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Full exception stacktrace (5.29 KB, text/plain)
2013-05-21 12:08 UTC, Marek Winkler
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker DROOLS-145 0 Major Resolved CCE during fact insertion when two instances of a KieSession are obtained for the same KieModule 2016-05-18 08:14:10 UTC

Description Marek Winkler 2013-05-21 12:08:36 UTC
Created attachment 751089 [details]
Full exception stacktrace

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.

Comment 1 Marek Winkler 2013-05-21 12:18:30 UTC
The reproducer test case can be found at https://github.com/droolsjbpm/drools/pull/200.

Comment 2 Marek Winkler 2013-06-11 10:34:57 UTC
Verified on BRMS 6.0.0 DR5 (Drools 6.0.0.Beta3).

Comment 6 Lukáš Petrovický 2014-02-07 16:15:45 UTC
This BZ has been part of the 6.0.0 stream.


Note You need to log in before you can comment on or make changes to this bug.