Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1048239

Summary: drools-jpa-persistence: java.lang.IllegalStateException: EntityManager is closed
Product: [Retired] JBoss BRMS Platform 6 Reporter: Marek Winkler <mwinkler>
Component: BREAssignee: Maciej Swiderski <mswiders>
Status: CLOSED CURRENTRELEASE QA Contact: Marek Winkler <mwinkler>
Severity: urgent Docs Contact:
Priority: high    
Version: 6.0.0CC: etirelli, mswiders, rzhang
Target Milestone: CR1Keywords: Regression
Target Release: 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 20:20:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Maven project with reproducer
none
standalone.xml with configured datasource
none
server.log with IllegalStateException none

Description Marek Winkler 2014-01-03 13:24:23 UTC
Created attachment 844955 [details]
Maven project with reproducer

Description of problem:

The exception java.lang.IllegalStateException: EntityManager is closed occurs when the session is disposed during the transaction.

Version-Release number of selected component (if applicable):
BRMS 6.0.0 ER7
Drools 6.0.1-SNAPSHOT

This worked with ER6, marking as a regression.

How reproducible:

Please run the attached reproducer maven project:

1. Update the src/main/resources/arquillian.xml in the attached project to the directory of your EAP 6.1.1.
2. You might need a datasource, the one in the attached standalone.xml will do.
3. Execute mvn clean install.

Actual results:

Exception is thrown.

Expected results:

The tests pass.

Comment 1 Marek Winkler 2014-01-03 13:30:29 UTC
Created attachment 844956 [details]
standalone.xml with configured datasource

Added standalone.xml configuring required in-memory datasource.

Comment 2 Maciej Swiderski 2014-01-03 14:00:36 UTC
fixed pushed to master, waiting for all acks before back porting to 6.0.x

drools
master:
https://github.com/droolsjbpm/drools/commit/931bb96a17d6ad489ed88877b56c8ab2bb3522b4

Comment 3 Edson Tirelli 2014-01-03 16:56:51 UTC
This is a regression, so engineering agrees with QA that this is a blocker.

Comment 4 Maciej Swiderski 2014-01-06 13:22:46 UTC
backported to 6.0.x

drools
6.0.x:
https://github.com/droolsjbpm/drools/commit/8f90493c6f42991819fc4de86d096c1ded5db6ba

Comment 5 Marek Winkler 2014-01-23 17:08:26 UTC
Created attachment 854492 [details]
server.log with IllegalStateException

The original exception is not thrown any more and the tests pass with CR1.

However, server.log (see the attachment for full stacktrace) contains warning messages complaining about IllegalStateException during transaction completion:

17:56:18,399 WARN  [com.arjuna.ats.jta] (http-/127.0.0.1:8080-1) ARJUNA016029: SynchronizationImple.afterCompletion - failed for org.drools.persistence.jta.JtaTransactionSynchronizationAdapter@1588dd94 with exception: java.lang.IllegalStateException: Illegal method call. This session was previously disposed.
	at org.drools.core.reteoo.DisposedReteooWorkingMemory.getProcessRuntime(DisposedReteooWorkingMemory.java:261) [drools-core-6.0.2-redhat-1.jar:6.0.2-redhat-1]
	at org.drools.core.impl.StatefulKnowledgeSessionImpl.getProcessRuntime(StatefulKnowledgeSessionImpl.java:900) [drools-core-6.0.2-redhat-1.jar:6.0.2-redhat-1]
...

If engineering confirms these warnings are not a sign of a deeper problem, we could fix this for 6.0.1, otherwise we will need a fix.

To reproduce, use the same reproducer already attached, just change drools.version to "6.0.2-redhat-1" (CR1) in pom.xml.

Comment 6 Marek Winkler 2014-01-23 17:26:48 UTC
I have discussed this with Maciej and this is the expected behaviour for this kind of tests (disposing KieSession during transaction).

Marking as verified on BRMS 6.0.0 CR1.