Bonita Engine giving different process definition info and activities after restarting Bonita

We have a Bonita 7.14 instance with a workflow that was migrated from Bonita 7.3.  The migrated workflow exhibits a strange behavior.  We can complete the entire workflow if we don’t restart Bonita before it completes.  However, if we start the workflow, restart Bonita, and then try to complete the workflow, it fails.  What seems to be happening, is that when Bonita is restarted, new instances of the flow definition are created in the flow node_instance table.  When the Java code gets to the validate step ( ProcessAPIImpl.java -> throwContractViolationExceptionIfContractIsInvalid -> userTaskDefinition -> getFlowNode()-> getFlowNodeFromSubProcesses) there is now a mismatch between the flow definitionid being used for the request.  We do not know from where the new mapping of process to flownode defintion mappings are coming from. 

 

Here’s an example:

 

Working scenario:

1. workflow instance submitted

2. Took action

3. Action was successful

 

Not working scenario:

1. workflow instance submitted

2. restarted Bonita

3. Took action

4. Action is not successful -- getFlowNodeFromSubProcesses not able to recognize activity, because of throwContractViolationExceptionIfContractIsInvalid

 

List key records before the restart:

flownode_instance

process_instance

process_definition

 

We debugged Bonita engine code that's giving the worng process defination info here

ProcessDefinitionServiceImpl.java -> getProcessDefinition -> readSProcessDefinitionFromDatabase

 

 

Logs are here:

Error log on Bonita sever.  The tracked the original exception to be throwContractViolationExceptionIfContractIsInvalid.  It shows up in the log this way because the there are a couple places where exceptions are caught and rethrown.

'org.bonitasoft.engine.api.impl.ServerAPIImpl$$Lambda$562/0x0000000840a9f040@58d9b498' has thrown an exception: java.lang.NullPointerException

org.bonitasoft.engine.api.impl.ServerAPIRuntimeException: java.lang.NullPointerException

        at org.bonitasoft.engine.api.impl.ServerAPIImpl.lambda$invokeAPIInTransaction$1(ServerAPIImpl.java:401) ~[bonita-server-7.14.0.jar:?]

        at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:269) [bonita-server-7.14.0.jar:?]

        at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPIInTransaction(ServerAPIImpl.java:395) [bonita-server-7.14.0.jar:?]

        at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeAPI(ServerAPIImpl.java:269) [bonita-server-7.14.0.jar:?]

        at org.bonitasoft.engine.api.impl.ServerAPIImpl.invokeMethod(ServerAPIImpl.java:125) [bonita-server-7.14.0.jar:?]

        at org.bonitasoft.engine.api.internal.servlet.HttpAPIServletCall.doPost(HttpAPIServletCall.java:112) [bonita-server-7.14.0.jar:?]

        at org.bonitasoft.engine.api.internal.servlet.HttpAPIServlet.callHttpApi(HttpAPIServlet.java:57) [bonita-server-7.14.0.jar:?]

        at org.bonitasoft.engine.api.internal.servlet.HttpAPIServlet.doPost(HttpAPIServlet.java:52) [bonita-server-7.14.0.jar:?]

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:681) [servlet-api.jar:4.0.FR]

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) [servlet-api.jar:4.0.FR]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) [catalina.jar:9.0.58]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [catalina.jar:9.0.58]

        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-websocket.jar:9.0.58]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [catalina.jar:9.0.58]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [catalina.jar:9.0.58]

        at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) [urlrewritefilter-4.0.3.jar:4.0.3]

        at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) [urlrewritefilter-4.0.3.jar:4.0.3]

        at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) [urlrewritefilter-4.0.3.jar:4.0.3]

        at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394) [urlrewritefilter-4.0.3.jar:4.0.3]

 

Any suggestions ?