pefernan opened a new issue, #2339:
URL: https://github.com/apache/incubator-kie-issues/issues/2339

   A _NullPointerException_ occurs in `JDBCProcessInstances.getUniqueEvents()` 
when retriggering a `CallActivity` node that has `waitForCompletion="true"` 
configured. The issue is caused by nested execution calls prematurely unloading 
the parent process instance state.
   
   The NPE occurs due to a state management issue when nested execution calls 
happen on the same process instance. When retriggering a CallActivity node with 
`waitForCompletion="true"`, the retrigger operation aborts the existing 
subprocess, which in turn sends a signal back to the parent process. This 
creates a nested call to `executeInWorkflowProcessInstanceWrite()` on the same 
process instance while the outer retrigger call is still executing. The nested 
call completes its execution and calls `internalUnloadProcessInstanceState()`, 
which sets the processInstance field to null as part of its cleanup. When 
control returns to the outer call, it attempts to persist the process instance 
state via `syncPersistence()`, which calls `JDBCProcessInstances.update()`. 
This method needs to access the process instance through `getUniqueEvents()` to 
retrieve event types for persistence, but since the nested call already 
unloaded the state, `internalGetProcessInstance()` returns null, causing the
  NullPointerException. 
   
   NullPointerException is thrown:
   
   ```
   java.lang.NullPointerException: Cannot invoke 
"org.jbpm.workflow.instance.WorkflowProcessInstance.getEventTypes()" because 
the return value of 
"org.kie.kogito.process.impl.AbstractProcessInstance.internalGetProcessInstance()"
 is null
       at 
org.kie.kogito.persistence.jdbc.JDBCProcessInstances.getUniqueEvents(JDBCProcessInstances.java:69)
       at 
org.kie.kogito.persistence.jdbc.JDBCProcessInstances.update(JDBCProcessInstances.java:88)
   ```
   
   **How to Reproduce:**
   
   - Create a process with a CallActivity node configured with 
`waitForCompletion="true"`
   - Start a process instance
   - Use the Process Management API to retrigger the `CallActivity` node 
instance:
      `POST 
/management/processes/{processId}/instances/{processInstanceId}/nodeInstances/{nodeInstanceId}`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to