Duplicate instances initiated in complete task

Hello team,
I am facing unexpected issue I have a maker user task which hit complete button to move task to a checker user task, if the environment got 403 for any reason the UI tell to retry which force user to hit it maybe twice or three times, checking the task list for checker I found 3 duplicated instances instantiated from nowhere, also variables sent while complete task with variables got duplicated 3 TIMES!!
It doesn’t make sense to such concurrency issue to be happed,
my expectation is:

  • even to overwrite the variable value not to make 3 identical variables.
  • if one of the tasks got completed it should throw no task id found to complete again.
  • I use the application Id from a variable to know the task id to be complete in this case even if we got the new task id to be completed would through exception as it is waiting for gateway expression to be passed.

here is the code snippet:-

val tasks = taskService.createTaskQuery().orderByTaskCreateTime().asc().list()
tasks.find {
getTaskVariable(it.id, BackofficeApplicationVariables.APPLICATION_ID).toString() == applicationId
}?.let {
if (it.assignee == SecurityUtil.getUsernameFromToken()) {
taskService.complete(it.id, variables)
}


@jonathan.lukas could you help on that :face_in_clouds:

Hello @SaraElmaghraby ,

this looks very interesting.
Could you please upload the process model? This would help us to identify potential problems.

Jonathan

I removed rest flow and updated some confidential data
issue_model.bpmn (8.6 KB)

@SaraElmaghraby,
Is this process a child process? (a sub process)
If you open user tasks tab, do you see 3 different checker tasks ?

A side note, you need to check the 403 reason and fix it in order not to ask the user to retry.
And the UI should deactivate the button until you receive a response from the “submit task” API