Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-1593

Ruleflow Split (XOR) can't find valid outgoing connection

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.1.0.Beta3
    • 6.5.0.Final, 7.0.0.CR3
    • core engine
    • None
    • 2017 Week 22-23 - remove
    • Hide

      1) Clone this repo: https://github.com/DuncanDoyle/ruleflow-split-problem
      2) Run "mvn clean test" (this runs with 7.0.0-SNAPSHOT). This will show the exception
      3) Run "mvn clean test -P 6.4.0.Final" (this runs with 6.4.0.Final). This does not show the exception, everything works fine.
      4) Run "mvn clean test -P 6.5.0.Final" (this runs with 6.5.0.Final). This will show the exception.

      Show
      1) Clone this repo: https://github.com/DuncanDoyle/ruleflow-split-problem 2) Run "mvn clean test" (this runs with 7.0.0-SNAPSHOT). This will show the exception 3) Run "mvn clean test -P 6.4.0.Final" (this runs with 6.4.0.Final). This does not show the exception, everything works fine. 4) Run "mvn clean test -P 6.5.0.Final" (this runs with 6.5.0.Final). This will show the exception.
    • Hide

      Add an extra "fireAllRules" command before the "startProcess" command.

      Show
      Add an extra "fireAllRules" command before the "startProcess" command.
    • NEW
    • NEW

      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:

      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
      

      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).

              mfusco@redhat.com Mario Fusco
              rhn-gps-ddoyle Duncan Doyle (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: