[jboss-jira] [JBoss JIRA] (DROOLS-1359) Race condition in MVELDialectRuntimeData.getParserConfiguration

Anuj Shah (JIRA) issues at jboss.org
Tue Nov 15 13:02:00 EST 2016


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

Anuj Shah commented on DROOLS-1359:
-----------------------------------

I have a test case that i can only get to fail with break points to simulate the race. The stack trace is:

{noformat}
[Error: unable to resolve method using strict-mode: drools1359.Fact.staticMethod(java.lang.String)]
[Near : {... staticMethod(arg) ....}]
             ^
[Line: 1, Column: 1]
	at org.mvel2.compiler.PropertyVerifier.getMethod(PropertyVerifier.java:579)
	at org.mvel2.compiler.PropertyVerifier.analyze(PropertyVerifier.java:120)
	at org.mvel2.compiler.ExpressionCompiler.verify(ExpressionCompiler.java:373)
	at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:266)
	at org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:52)
	at org.mvel2.MVEL.compileExpression(MVEL.java:810)
	at org.drools.core.base.mvel.MVELCompilationUnit.compile(MVELCompilationUnit.java:433)
	at org.drools.core.base.mvel.MVELCompilationUnit.getCompiledExpression(MVELCompilationUnit.java:249)
	at org.drools.core.rule.constraint.MvelConstraint.createMvelConditionEvaluator(MvelConstraint.java:254)
	at org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:238)
	at org.drools.core.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:204)
	at org.drools.core.reteoo.AlphaNode.assertObject(AlphaNode.java:141)
	at org.drools.core.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:60)
	at org.drools.core.reteoo.ObjectTypeNode.propagateAssert(ObjectTypeNode.java:298)
	at org.drools.core.phreak.PropagationEntry$Insert.execute(PropagationEntry.java:93)
	at org.drools.core.phreak.SynchronizedPropagationList.flush(SynchronizedPropagationList.java:96)
	at org.drools.core.phreak.SynchronizedPropagationList.flush(SynchronizedPropagationList.java:69)
	at org.drools.core.impl.StatefulKnowledgeSessionImpl.flushPropagations(StatefulKnowledgeSessionImpl.java:1993)
	at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1289)
	at org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(StatefulKnowledgeSessionImpl.java:1294)
	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1281)
	at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1260)
	at drools1359.TestRaceCondition$1.call(TestRaceCondition.java:73)
	at drools1359.TestRaceCondition$1.call(TestRaceCondition.java:1)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:744)
{noformat}

> Race condition in MVELDialectRuntimeData.getParserConfiguration
> ---------------------------------------------------------------
>
>                 Key: DROOLS-1359
>                 URL: https://issues.jboss.org/browse/DROOLS-1359
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine
>    Affects Versions: 5.5.0.Final, 6.5.0.Final
>            Reporter: Anuj Shah
>            Assignee: Mario Fusco
>
> MVELDialectRuntimeData attempts to hold a lazy loaded ParserConfiguration. The getParserConfiguration method sets this to a new configuration object and then sets the imports on the configuration. Between these two steps another thread could retrieve the stale configuration and use it. This could result in a number of exceptions in compilation.
> A simple fix is to delay assignment of new ParserConfiguration until after the imports are set.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list