]
Mario Fusco commented on DROOLS-1593:
-------------------------------------
[~swiderski.maciej], ok, it was a false negative, even jenkins is green now. Please let me
know if I can merge those PRs.
Ruleflow Split (XOR) can't find valid outgoing connection
---------------------------------------------------------
Key: DROOLS-1593
URL:
https://issues.jboss.org/browse/DROOLS-1593
Project: Drools
Issue Type: Bug
Components: core engine
Affects Versions: 6.5.0.Final, 7.0.0.CR3
Environment: Drools 7.0.0-SNAPSHOT, Oracle Hotspot 1.8.0_112, KIE-Server,
OpenShift DecisionServer
Reporter: Duncan Doyle
Assignee: Mario Fusco
This seems like a regression, as this used to work in 6.4.0.Final, but broke somewhere
before 6.5.0.Final. Still broken in 7.0.0-SNAPSHOT. (I actually found it in the OpenShift
DecisionServer/KIE-Server image).
See this reproducer:
https://github.com/DuncanDoyle/ruleflow-split-problem
I have a ruleflow-group that has a split-node (XOR Gateway) directly after the
start-node. The outgoing sequence flows of that XOR have a Drools LHS that checks whether
a fact is present in working memory (in this reproducer it's a String)
- exists java.lang.String()
- not java.lang.String()
Only if that fact exists do I want to continue my ruleflow, if the fact is not there, I
stop.
I use a StatelessKieSession in which I;
- insert a String
- start the process
- fire the rules
This used to work fine in 6.4.0.Final and below, but since 6.5.0.Final I get an
exception:
{code}
org.jbpm.workflow.instance.WorkflowRuntimeException: [test-process:1 - Has Strings?:4] --
XOR split could not find at least one valid outgoing connection for split Has Strings?
at org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:66)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:174)
at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:367)
at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:326)
at
org.jbpm.workflow.instance.node.StartNodeInstance.triggerCompleted(StartNodeInstance.java:72)
at
org.jbpm.workflow.instance.node.StartNodeInstance.internalTrigger(StartNodeInstance.java:43)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:174)
at
org.jbpm.ruleflow.instance.RuleFlowProcessInstance.internalStart(RuleFlowProcessInstance.java:38)
at
org.jbpm.process.instance.impl.ProcessInstanceImpl.start(ProcessInstanceImpl.java:235)
at
org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.start(WorkflowProcessInstanceImpl.java:443)
at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:208)
at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:192)
at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:184)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:1859)
at
org.drools.core.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:121)
at
org.drools.core.command.runtime.process.StartProcessCommand.execute(StartProcessCommand.java:39)
at
org.drools.core.command.runtime.BatchExecutionCommandImpl.execute(BatchExecutionCommandImpl.java:156)
at
org.drools.core.command.runtime.BatchExecutionCommandImpl.execute(BatchExecutionCommandImpl.java:64)
at
org.drools.core.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:238)
at
org.jboss.ddoyle.ruleflow.test.RuleflowTest.testRuleflowWithSingleFire(RuleflowTest.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.IllegalArgumentException: XOR split could not find at least one
valid outgoing connection for split Has Strings?
at
org.jbpm.workflow.instance.node.SplitInstance.executeStrategy(SplitInstance.java:110)
at org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:62)
... 42 more
{code}
What seems to be causing this is that the rules in the sequence flows are not yet fired
when the process arrives at the XOR node, causing it to not be able to find an outgoing
connection.
What does work is if I add an extra "fireAllRules" command BEFORE the
"startProcess" command. In that case the flow behaves as it used to. So I need 2
"fireAllRules" commands. What does NOT work is when I only add a
"fireAllRules" command before the startProcess command. In that case the rules
in the RFG nodes are not fired (but the XOR does not throw an exception in that case).