Bug 1279402

Summary: KieRepository is not completely thread safe
Product: [Retired] JBoss BRMS Platform 6 Reporter: Tibor Zimanyi <tzimanyi>
Component: BREAssignee: Mario Fusco <mfusco>
Status: CLOSED NOTABUG QA Contact: Tibor Zimanyi <tzimanyi>
Severity: low Docs Contact:
Priority: high    
Version: 6.2.0CC: etirelli
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-10 10:28:49 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:

Description Tibor Zimanyi 2015-11-09 11:39:23 UTC
Description of problem:

KieRepository is not completely thread safe, so when many threads concurrently add and remove KieModules, this can lead to a NPE.


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


How reproducible:

Run IncrementalCompilationTest.testConcurrentKJarDeployment test method [1] with raised number of threads (e.g. 200). 

[1] https://github.com/droolsjbpm/drools/blob/a53b630f21ff8ab65de8f22d28611160ba5936d3/drools-compiler/src/test/java/org/drools/compiler/integrationtests/IncrementalCompilationTest.java#L1913

Actual results: 

The test fails. 


Expected results: 

The test passes.

Comment 2 JBoss JIRA Server 2015-11-09 11:40:58 UTC
Tibor Zimányi <tzimanyi> updated the status of jira DROOLS-923 to Reopened

Comment 3 Mario Fusco 2015-11-10 10:28:49 UTC
The NullPointerException reported by Tibor is not caused by a concurrency issue, but by the LRU cache that we introduced to workaround this other problem https://bugzilla.redhat.com/show_bug.cgi?id=1273368

That cache by default has a max size of 100 items https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/main/java/org/drools/compiler/kie/builder/impl/KieRepositoryImpl.java#L257 and increasing this size makes the NPE to disappear.

Comment 4 JBoss JIRA Server 2015-11-10 10:29:27 UTC
Mario Fusco <mario.fusco> updated the status of jira DROOLS-923 to Resolved