[jboss-jira] [JBoss JIRA] (DROOLS-497) KnowledgeBase's ruleBase is never unlocked when an exception is thrown by executed rules

Antonio Ruberto (JIRA) issues at jboss.org
Thu May 22 11:30:56 EDT 2014


     [ https://issues.jboss.org/browse/DROOLS-497?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antonio Ruberto updated DROOLS-497:
-----------------------------------

    Attachment: drool-497.zip


Attached project to reproduce issue.

Main method does following:

1) Builds KnowledgeBase

2) Creates 2 threads, each thread creates knowledge session from knowledge base and then calls fireAllRules(). You'll notice that 2nd thread never terminates (never reaches its "Done" print statement)

> KnowledgeBase's ruleBase is never unlocked when an exception is thrown by executed rules
> ----------------------------------------------------------------------------------------
>
>                 Key: DROOLS-497
>                 URL: https://issues.jboss.org/browse/DROOLS-497
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 5.6.0.Final
>            Reporter: Antonio Ruberto
>            Assignee: Mark Proctor
>         Attachments: drool-497.zip
>
>
> We have a KnowledgeBase that is built application start up from which we constantly create new KnowledgeSession from.
> If the execution of one of those sessions throws an exception (i.e. one of the rules in the KnowledgeBase throws an exception for some reason), any subsequent KnowledgeSessions that are created and executed get dead locked. The issue stems from the initInitialFact() method in AbstractWorkingMemory.java as seen below. An exception thrown by the underlying rule causes ruleBase.unlock() to never be reached.
> {code}
>     public void initInitialFact( InternalRuleBase ruleBase, MarshallerReaderContext context ) {
>         ruleBase.lock();
>         Object initialFact = InitialFactImpl.getInstance();
>         ObjectTypeConf otc = this.defaultEntryPoint.getObjectTypeConfigurationRegistry()
>                 .getObjectTypeConf( this.defaultEntryPoint.entryPoint, initialFact );
>         this.initialFactHandle = ruleBase.getConfiguration().getComponentFactory().getFactHandleFactoryService().newFactHandle(
>                 0, initialFact, 0, otc, this, this.defaultEntryPoint );
>         final PropagationContext pctx = new PropagationContextImpl( 0,
>                                                                     PropagationContext.ASSERTION,
>                                                                     null,
>                                                                     null ,
>                                                                     initialFactHandle,
>                                                                     0,
>                                                                     0,
>                                                                     defaultEntryPoint.getEntryPoint(),
>                                                                     context );
>         otc.getConcreteObjectTypeNode().assertObject( this.initialFactHandle, pctx, this );
>         // ADDED, NOT IN THE ORIGINAL 6.x COMMIT
>         pctx.evaluateActionQueue( this );
>         ruleBase.unlock();
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.2.3#6260)


More information about the jboss-jira mailing list