Bug 1036761

Summary: It is not possible to restore a ksession on Oracle11gR2 due to RuntimeException: Unable to begin transaction
Product: [Retired] JBoss BPMS Platform 6 Reporter: Ivo Bek <ibek>
Component: jBPM CoreAssignee: Maciej Swiderski <mswiders>
Status: CLOSED CURRENTRELEASE QA Contact: Ivo Bek <ibek>
Severity: high Docs Contact:
Priority: high    
Version: 6.0.0CC: etirelli, mbaluch, rrajasek, rzhang
Target Milestone: ER 7   
Target Release: 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Oracle11gR2 jbpm 6 - redhat-6 dependencies
Last Closed: 2014-08-06 20:11:09 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
stacktrace
none
the process definition where I restore a ksession none

Description Ivo Bek 2013-12-02 15:13:03 UTC
Created attachment 831629 [details]
stacktrace

Description of problem:

First, see the attached process definition. After I complete the first task1, I restore the singleton ksession. The restore means:

disposeRuntimeManager();
createRuntimeManager(processDefinitions);
return getRuntimeEngine().getKieSession();

As it tries to restore runtimemanager "manager = managerFactory.newSingletonRuntimeManager(environment);", I get this exception: RuntimeException: Unable to begin transaction -- details are in the attached stacktrace

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


How reproducible:


Steps to Reproduce:
1. Configure persistence.xml to use Oracle11gR2 database
2. Setup datasource and session persistence (for that you can use JbpmJUnitBaseTestCase)
3. Run the attached process definition via java api (Also I'll add a link to the source code)
4. See the output - compare with the attached stacktrace

Actual results:


Expected results:


Additional info:

Comment 2 Ivo Bek 2013-12-02 15:18:15 UTC
Created attachment 831630 [details]
the process definition where I restore a ksession

Comment 3 Maciej Swiderski 2013-12-12 13:19:46 UTC
Ivo, I believe that main problem here is that you dispose ksession directly without using RuntimeManager.disposeRuntimeEngine which is for exactly that purpose. If you manually dispose ksession then all other components like timer service and others might still be active and will cause the unexpected issues.

Please ensure that you always use RuntimeManager and RuntimeEngine to dispose underlying resources.

When it comes to the exceptions with bitronix, it looks like bitronix is closed before application components such as RuntimeManager/RuntimeEngine and thus failing on accessing the transaction log that is actually a file.

Could you please double check your tests and apply above suggestions to check if that is still the case?

Comment 4 Edson Tirelli 2013-12-12 13:47:33 UTC
Proposing the blocker flag as agreed in the triage meeting, but please check if this is really an issue and fix or close as non issue, accordingly.

Comment 8 Maciej Swiderski 2013-12-16 16:53:39 UTC
it was caused by canceling timer that was in progress and by that owned transaction log channel. By canceling, thread pool send interput signal to the thread and by that channel used for transaction log was directly closed. Thread pool factory was added to timer to ensure it won't interrupt the transaction log. 

jbpm
master:
https://github.com/droolsjbpm/jbpm/commit/f67a81b8cf8b7e29c6f3ef39fd5d10498496cbfe

6.0.x:
https://github.com/droolsjbpm/jbpm/commit/8d223329a5143e35276f8931efa6ae0618bd8173

Comment 9 Ivo Bek 2014-01-07 16:45:42 UTC
Verified in BPMS 6.0.0.ER7