Fail to delete one deployment

Hi Sir,

When I use REST API ‘repository/deployments/{processInstanceId}’ to remove a process, it may return ‘Internal server error’ in sometime. Here is the response from API,

{
    "message": "Internal server error",
    "exception": "\n### Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`flowable`.`ACT_RU_EXECUTION`, CONSTRAINT `ACT_FK_EXE_PROCDEF` FOREIGN KEY (`PROC_DEF_ID_`) REFERENCES `ACT_RE_PROCDEF` (`ID_`))\n### The error may involve org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntityImpl.deleteProcessDefinitionsByDeploymentId-Inline\n### The error occurred while setting parameters\n### SQL: delete from ACT_RE_PROCDEF where DEPLOYMENT_ID_ = ?\n### Cause: java.sql.SQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`flowable`.`ACT_RU_EXECUTION`, CONSTRAINT `ACT_FK_EXE_PROCDEF` FOREIGN KEY (`PROC_DEF_ID_`) REFERENCES `ACT_RE_PROCDEF` (`ID_`))"
}

Does anyone can teach me how to fix this one? Thanks.

Hi there!

Looks like there are still connections to your process defininitions (e.g. running instances).
You can try to add the parameter cascade=true to also delete the instances and jobs connected to that deployment:

repository/deployments/{deploymentId}?cascade=true

This call will probably response with the status code 204.

Regards,
Matthias

1 Like

Just FYI what @matthias.stoeckli is proposing would also delete the historic process instances. If you don’t want to do that then I would suggest that you first query all running process instances within that deployment, delete them (they would stay in the historic process instances table) and then delete the deployment.

1 Like

Got it. Thanks! I must remove all running instances.