Bug 729915

Summary: Methods called on disposed knowledge session should throw an exception
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Tomas Schlosser <tschloss>
Component: BRE (Expert, Fusion)Assignee: Nobody <nobody>
Status: VERIFIED --- QA Contact: Lukáš Petrovický <lpetrovi>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.1.0 GA, BRMS 5.2.0-ER1CC: atangrin, mproctor
Target Milestone: ---   
Target Release: BRMS 5.3.0.GA   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
An error occurred where inserting facts into a disposed stateful knowledge session should result in an exception being thrown, however, no exception was thrown. This has been resolved and the illegalStateException is now thrown when inserting facts into a disposed stateful knowledge session.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 734762    

Description Tomas Schlosser 2011-08-11 09:28:25 UTC
Description of problem:
When you try to run a simple code (see the end of description) where you insert facts into disposed stateful knowledge session you get no exception warning you that you are using disposed session. However it works (fact is inserted, rules fire) the bug is that it doesn't work with named entry points. If you try inserting event into entry point you get NullPointerException:
java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1956) 
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:816) 
at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:299) 
at java.util.concurrent.ScheduledThreadPoolExecutor.schedule(ScheduledThreadPoolExecutor.java:478) 
at org.drools.time.impl.JDKTimerService.schedule(JDKTimerService.java:114) 
at org.drools.time.impl.JDKTimerService.scheduleJob(JDKTimerService.java:80) 
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:205) 
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:145) 
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:176) 
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:145) 
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:96) 
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:44) 
at org.jboss.qa.drools.features.cep.EventLifecycleTest.testManagedLifecycle(EventLifecycleTest.java:130)


Additional info:
StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession();
session.insert("hello world");
session.fireAllRules();

session.dispose();

session.insert("goodbye world");
session.fireAllRules();
ksession.getWorkingMemoryEntryPoint("EventStream").insert("this one throws NPE");

Comment 1 Anne-Louise Tangring 2011-08-12 15:06:41 UTC
Border line enhancment request.

Comment 3 Mark Proctor 2012-01-19 01:24:24 UTC
We'll generate a proxy that throws exceptions when used.

Comment 4 Edson Tirelli 2012-01-19 23:27:23 UTC
This was fixed at the same time as https://bugzilla.redhat.com/show_bug.cgi?id=734762

Comment 6 Tomas Schlosser 2012-01-30 14:28:45 UTC
It is fixed now. Thank you

Comment 7 lcarlon 2012-05-03 02:15:41 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
An error occurred where inserting facts into a disposed stateful knowledge session should result in an exception being thrown, however, no exception was thrown. This has been resolved and the illegalStateException is now thrown when inserting facts into a disposed stateful knowledge session.