I have got a multi instance call to a subprocess including a finishing condition flag.
  From one  the  subprocess being called that flag maybe set in the parent process which causes the other subprocesses in the multi-instance to finish , and that works fine (sometimes…)
    
     the subprocess has a couple of user-tasks and I realized that once you have performed some in one of the process if the flag is set to terminate in a different instance this causes foreign key violations when trying to terminate the rest.
     Specifically on the table act_ru_task, and the foreign keys are , act_fk_task_exe and  act_fk_task_procinst.
    Changing the foreign keys to On delete cascade gets rid of the issue.., but that may be too drastic?
    I am using version 5.18
Regards,
Jose