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

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


    [ https://issues.jboss.org/browse/DROOLS-1046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13156381#comment-13156381 ] 

Akshay Gehi commented on DROOLS-1046:
-------------------------------------

Hi,

One of the test cases had failed but it may not be related to this change. Do you think it would be safe to check this change in our codebase locally?

> 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