A user task with skipExpression evaluated to true and has candidate users will cause db exception

Description

Say if we have a user task defined as follow:

Then we'll get a exception like below:

I did some analysis and found the root cause is that in the handleAssignments() of UserTaskActivityBehavior, as the candidate users is not empty, it will generate insert statement of identityLinkEntity. While as the skipExpression is true, it will complete the task in the same transaction, and in the TaskEntry.complete(), when it tries to delete the task, it will only generate delete statements for those identityLinkEntity already in the database, so that the previous insert statement is not removed at the end (in the DbSqlSession.flush()), while the related task's insert statement is removed. which causes the above exception.

Environment

None

Status

Assignee

Joram Barrez

Reporter

Sun Qin

Labels

None

Components

Affects versions

5.19

Priority

High
Configure