[
https://issues.jboss.org/browse/DROOLS-1046?page=com.atlassian.jira.plugi...
]
Akshay Gehi updated DROOLS-1046:
--------------------------------
Steps to Reproduce:
Create a drools file with the following condition:
{noformat}
rule "slowWhenCondition"
when
eval(mySlowCondition(fact))
then
end
{noformat}
Create a StatefulSession and fire all the rules from multiple threads. Observe the threads
in Blocking state using JVisualVM or Stack Trace.
was:
Create a drools file with the following condition:
rule "slowWhenCondition"
when
eval(mySlowConditionFromDatabase(fact))
then
end
Create a StatefulSession and fire all the rules from multiple threads. Observe the threads
in Blocking state using JVisualVM or Stack Trace.
Threads blocking during ReteWorkingMemory initialization of facts
-----------------------------------------------------------------
Key: DROOLS-1046
URL:
https://issues.jboss.org/browse/DROOLS-1046
Project: Drools
Issue Type: Bug
Components: core engine
Affects Versions: 6.3.0.Final
Reporter: Akshay Gehi
Assignee: Mario Fusco
While initializing facts for the first time the following method in ReteWorkingMemory is
invoked:
{code:java}
private final Integer syncLock = 42;
public void initInitialFact() {
if ( initialFactHandle == null ) {
synchronized ( syncLock ) {
if ( initialFactHandle == null ) {
// double check, inside of sync point incase some other thread beat
us to it.
initInitialFact(kBase, null);
}
}
}
}
{code}
Since the synchronized lock is taken on a Integer constant variable, the same object gets
used across different threads. This causes the initialization of all the ReteMemoryObjects
to wait in the initInitialFact() method across different threads.
The lock should be taken on Object lock = new Object() instead
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)