[jboss-jira] [JBoss JIRA] (DROOLS-1046) Threads blocking during ReteWorkingMemory initialization of facts

Akshay Gehi (JIRA) issues at jboss.org
Fri Jan 29 02:37:00 EST 2016


Akshay Gehi created DROOLS-1046:
-----------------------------------

             Summary: 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)


More information about the jboss-jira mailing list