<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Old JBPM (ver 3.2.7) non-logical exception "org.jbpm.JbpmException: transition 'no-work-done' does not exist on Node(preScan)"
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/d_edery">David Edery</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/717230#717230">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi</p><p>We are using JBPM 3.2.7 in our large-scale application for a long time now.</p><p>Recently, due to race-conditions with the DB commit we have decided to move from persistent mode (in which all the process-definitions, process-instances etc... were stored in the DB) to non-persistent that works in the following flow:</p><ol><li style="text-align: start;">We read all the .xml files containing process definitions.</li><li style="text-align: start;">For each .xml file we create a process definition and store it in a static map.</li><li style="text-align: start;">When the user wants to activate a flow (it's usually the same flow on multiple targets) - <strong>we create a new ProcessInstance based on the same instance of ProcessDefinition </strong>(this might explain the phenomena but we didn't see how from the code).</li><li style="text-align: start;">Each thread in a dedicated thread pool takes one ProcessInstance and activates it (via .signal).</li><li style="text-align: start;">Each action calls the .signal (with or without transition name) in the end of its business logic - thus creating a synchronized workflow.</li></ol><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="text-align: start;">Recently we have encountered a problem (it occurred only one time) that caused failure in some of the targets (ProcessInstances).</p><p style="text-align: start;">The exception was (full stack-trace attached to the discussion, highlighted lines describe the flow):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>org.jbpm.JbpmException: transition 'no-work-done' does not exist on Node(preScan)</strong></p><p>&#160;&#160;&#160; at org.jbpm.graph.exe.<strong>Token.signal</strong>(Token.java:170)</p><p>&#160;&#160;&#160; at com.yyyy.nms.massconfig.swdownload.<strong>PreScanAction.run</strong>(PreScanAction.java:42)</p><p>&#160;&#160;&#160; at com.yyyy.nms.massconfig.common.<strong>BaseAction.execute</strong>(BaseAction.java:71)</p><p>&#160;&#160;&#160; at org.jbpm.graph.def.Action.execute(Action.java:137)</p><p>&#160;&#160;&#160; at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:280)</p><p>&#160;&#160;&#160; at org.jbpm.graph.def.Node.execute(Node.java:395)</p><p>&#160;&#160;&#160; at org.jbpm.graph.def.Node.enter(Node.java:375)</p><p>&#160;&#160;&#160; at org.jbpm.graph.def.Transition.take(Transition.java:151)</p><p>&#160;&#160;&#160; at org.jbpm.graph.def.Node.leave(Node.java:453)</p><p>&#160;&#160;&#160; at org.jbpm.graph.exe.Token.signal(Token.java:214)</p><p>&#160;&#160;&#160; at org.jbpm.graph.exe.<strong>Token.signal</strong>(Token.java:143)</p><p>&#160;&#160;&#160; at com.yyyy.nms.massconfig.common.<strong>FirstWorkflowAction.run</strong>(FirstWorkflowAction.java:94)</p><p>&#160;&#160;&#160; at com.yyyy.nms.massconfig.common.<strong>BaseAction.execute</strong>(BaseAction.java:71)</p><p>&#160;&#160;&#160; at org.jbpm.graph.def.Action.execute(Action.java:137)</p><p>&#160;&#160;&#160; at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:280)</p><p>&#160;&#160;&#160; at org.jbpm.graph.def.Node.execute(Node.java:395)</p><p>&#160;&#160;&#160; at org.jbpm.graph.def.Node.enter(Node.java:375)</p><p>&#160;&#160;&#160; at org.jbpm.graph.def.Transition.take(Transition.java:151)</p><p>&#160;&#160;&#160; at org.jbpm.graph.def.Node.leave(Node.java:453)</p><p>&#160;&#160;&#160; at org.jbpm.graph.node.StartState.leave(StartState.java:78)</p><p>&#160;&#160;&#160; at org.jbpm.graph.exe.Token.signal(Token.java:214)</p><p>&#160;&#160;&#160; at org.jbpm.graph.exe.<strong>Token.signal</strong>(Token.java:143)</p><p>&#160;&#160;&#160; at org.jbpm.graph.exe<strong>.ProcessInstance.signal</strong>(ProcessInstance.java:287)</p><p>&#160;&#160;&#160; at com.yyyy.nms.jbpmworkflow.<strong>JbpmWorkflowInvoker</strong>.startNonPersistentWorkflow(JbpmWorkflowInvoker.java:271)</p><p>&#160;&#160;&#160; at com.yyyy.nms.jbpmworkflow.<strong>JbpmWorkflowInvoker</strong>.startWorkflow(JbpmWorkflowInvoker.java:350)</p><p>&#160;&#160;&#160; at com.yyyy.nms.jbpmworkflow.StartWorkflowMDB.signalWorkflow(StartWorkflowMDB.java:101)</p><p>&#160;&#160;&#160; at com.yyyy.nms.jbpmworkflow.<strong>StartWorkflowMDB</strong>.handleMessage(StartWorkflowMDB.java:85)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>In the .xml file from which the related ProcessDefinition was read looks like this (in the relevant part):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag">&lt;exception-handler&gt;</span>
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;action class="com.yyyy.nms.massconfig.common.ExceptionAction" /&gt;</span>
<span class="jive-xml-tag">&lt;/exception-handler&gt;</span>

<span class="jive-xml-tag">&lt;start-state&gt;</span>
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;transition to="check-suspend-or-abort"&gt;</span><span class="jive-xml-tag">&lt;/transition&gt;</span>
<span class="jive-xml-tag">&lt;/start-state&gt;</span>

<span class="jive-xml-tag">&lt;node name="check-suspend-or-abort"&gt;</span>
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;action class="com.yyyy.nms.massconfig.common.FirstWorkflowAction" /&gt;</span>
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;transition to="preScan"/&gt;</span>

&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;transition to="error" name="error"/&gt;</span>
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;transition to="suspended" name="suspended"/&gt;</span>
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;transition to="aborted" name="aborted"/&gt;</span>
<span class="jive-xml-tag">&lt;/node&gt;</span>


<span class="jive-xml-tag">&lt;node name="preScan" description="Pre-upgrade Scan" shouldField="preScan"&gt;</span>
&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;action class="com.yyyy.nms.massconfig.swdownload.PreScanAction" /&gt;</span>

&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;event type="node-enter"&gt;</span>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;action class="com.yyyy.nms.massconfig.common.StepStartAction" /&gt;</span> 
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/event&gt;</span>

&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;transition to="acquireFtpForUpload"&gt;</span> 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;action class="com.yyyy.nms.massconfig.common.StepDoneAction" /&gt;</span>
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/transition&gt;</span>

&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;transition to="acquireFtpForUpload" name="no-work-done"&gt;</span> 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;action class="com.yyyy.nms.massconfig.common.StepSkippedAction" /&gt;</span> 
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;/transition&gt;</span>

&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;transition to="error" name="error"/&gt;</span>
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;transition to="suspended" name="suspended"/&gt;</span>
&#160;&#160;&#160;&#160; <span class="jive-xml-tag">&lt;transition to="aborted" name="aborted"/&gt;</span>
<span class="jive-xml-tag">&lt;/node&gt;</span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>As you can see, if we are in the "preScan" node - we definitely have the "no-work-done" transition.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The scenario that produced this exception contained 40 process instances (=40 different targets) based on the same ProcessDefinition instance. Out of which 7 targets failed on this exception and the rest (which went through the same nodes and transitions) completed successfully (before and after the 7 failed).</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The only clue to a possible problem was that the JBPM exception thrown for all 7 targets was thrown <strong>at the same exact time </strong>(same millisecond even). Meaning - all 7 tried to perform the .signal("no-work-done") in the PreScanAction at the same exact time.</p><p>We have generated the same scenario on our development environment (using CountDownLatch in the prior to the .signal("no-work-done")) with 10 targets that wait together and all of them call the .signal("no-work-done") in the same exact millisecond - the failure was not reproduced.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Our question is - did you encounter such scenario? If so - was it fixed in newer versions? can we bypass it? (I thought about creating a new ProcessDefinition per ProcessInstance - this will cost a lot in terms of memory consumption and CPU load - but since I couldn't reproduce the problem, I'm not sure that it will solve it).</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Oh, we create the ProcessDefinitions map during server load. We don't change them after the creation of the map.</p><p>As you can see in the attached screenshot (from LogMX) - this is how it looks like, 7 different threads throw the same exception on the same time.</p><p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/2-717230-17993/transitionProblem.GIF"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/2-717230-17993/450-133/transitionProblem.GIF </span></a></p><p>Thank you for your time.</p><p>Sincerely</p><p>David Edery.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/717230#717230">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>