Bug 1012140

Summary: KieSession.fireUntilHalt() consumes 100% CPU
Product: [Retired] JBoss BRMS Platform 6 Reporter: Richard Bourner <rbourner>
Component: BREAssignee: Edson Tirelli <etirelli>
Status: CLOSED CURRENTRELEASE QA Contact: Tomas David <tdavid>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.0.0CC: ddoyle, rbourner
Target Milestone: ER5   
Target Release: 6.0.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 20:15:35 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 Eclipse project demonstrating the issue none

Description Richard Bourner 2013-09-25 19:46:10 UTC
Created attachment 803047 [details]
Maven Eclipse project demonstrating the issue

Description of problem:
When we run a KieSession.fireUntilHalt(), our application starts consuming 100% CPU, without anything actually happening inside the app (no events/facts are being inserted, no rules are activated/fired, etc.). We've tested this on multiple machines, different OSs, different JDKs, etc., and they all show the same behaviour.

Version-Release number of selected component (if applicable):
Drools 6.0.0.CR3
Mac OS-X 1.8.5 + Hotspot JDK 1.7.0_40
RHEL 6.4 + OpenJDK 1.7.0_25
Fedora 18 + Java 6.

How reproducible:
A small test demonstrating the problem has been created. 
The test loads a simple DRL via KieClasspathContainer, retrieves a new KieSession and runs a KieSession.fireUntilHalt() in a separate thread. 
After launching the thread, we let the main thread sleep for 30 seconds (3 * 10) and during this time period, CPU load increases to 100%. 
We then halt the session and sleep for another 10 seconds, which causes the CPU load to back to normal.

Steps to Reproduce:
1. run 'mvn clean test' on the project
2. monitor the CPU load on your system

Actual results:


Expected results:


Additional info:
This case is the same as the following: https://issues.jboss.org/browse/DROOLS-272

Comment 2 Edson Tirelli 2013-09-25 19:54:50 UTC
The current fireUntilHalt() implementation is using a busy wait loop. We need to replace it by a wait/notify in the PathMemory.doLinkRule().

Comment 3 Edson Tirelli 2013-09-26 13:40:08 UTC
This is a blocker from engineering perspective.

Comment 4 Lukáš Petrovický 2013-09-26 13:45:21 UTC
+1 from QE.

Comment 5 Edson Tirelli 2013-09-30 21:11:28 UTC
Just an update, I fixed the 100% CPU problem in a local branch, but that broke a list of other tests. I've been going through each of those tests and fixing the side effects of the code changes. I will keep you posted.

Comment 9 JBoss JIRA Server 2013-10-08 00:54:52 UTC
Edson Tirelli <ed.tirelli> updated the status of jira DROOLS-272 to Resolved

Comment 10 JBoss JIRA Server 2013-10-08 00:54:58 UTC
Edson Tirelli <ed.tirelli> updated the status of jira DROOLS-272 to Closed

Comment 12 Tomas David 2013-12-10 10:53:06 UTC
Verified on BRMS 6.0.0.ER5.