Bug 734762 - NPE when disposing already disposed StatefulKnowledgeSession
Summary: NPE when disposing already disposed StatefulKnowledgeSession
Keywords:
Status: VERIFIED
Alias: None
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: BRE (Expert, Fusion)
Version: BRMS 5.2.0.GA
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: BRMS 5.3.0.GA
Assignee: Edson Tirelli
QA Contact: Tomas Schlosser
URL:
Whiteboard:
Depends On: 729915
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-08-31 11:26 UTC by Tomas Schlosser
Modified: 2012-05-03 02:20 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
A Null Pointer Exception was thrown when calling StatefulKnowledgeSession.dispose() on already disposed session. The issue has been resolved, calling any session's method after disposing the session now raises an IllegalStateException.
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
JBoss Issue Tracker JBRULES-1880 None Closed Can fire rules after disposing the Stateful session 2012-05-30 05:17:04 UTC

Description Tomas Schlosser 2011-08-31 11:26:57 UTC
Description of problem:
When a StatefulKnowledgeSession.dispose() is called on already disposed session NullPointerException is thrown.

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

How reproducible:
every time

Steps to Reproduce:
1. create new stateful session
2. dispose it
3. dispose it again
  
Actual results:
java.lang.NullPointerException
	at org.jbpm.process.instance.ProcessRuntimeImpl.dispose(ProcessRuntimeImpl.java:371)
	at org.drools.common.AbstractWorkingMemory.dispose(AbstractWorkingMemory.java:1251)
	at org.drools.reteoo.ReteooStatefulSession.dispose(ReteooStatefulSession.java:179)
	at org.drools.impl.StatefulKnowledgeSessionImpl.dispose(StatefulKnowledgeSessionImpl.java:251)
	at org.jboss.qa.drools.disposeNPE.DisposeNPETest$Test.run(DisposeNPETest.java:51)
	at org.jboss.qa.drools.disposeNPE.DisposeNPETest.main(DisposeNPETest.java:35)

Expected results:


Additional info:
This is caused by users using dispose() as a way to clean the state of the session. I suppose that when session is disposed it should be unusable but in case of using it an understandable exception should be thrown (like AlreadyDisposedException). And the documentation should clearly state that disposed sessions are not to be used.

Comment 2 JBoss JIRA Server 2012-01-19 20:58:38 UTC
Edson Tirelli <ed.tirelli@gmail.com> updated the status of jira JBRULES-1880 to Resolved

Comment 3 JBoss JIRA Server 2012-01-19 20:58:38 UTC
Edson Tirelli <ed.tirelli@gmail.com> made a comment on jira JBRULES-1880

Fixed. Calling any session's method after disposing the session will now raise an IllegalStateException.

Comment 4 JBoss JIRA Server 2012-01-19 20:58:45 UTC
Edson Tirelli <ed.tirelli@gmail.com> updated the status of jira JBRULES-1880 to Closed

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

Comment 7 lcarlon 2012-05-03 02:20:19 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:
A Null Pointer Exception was thrown when calling StatefulKnowledgeSession.dispose() on already disposed session. The issue has been resolved, calling any session's method after disposing the session now raises
an IllegalStateException.


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