When try to cancel the process instance, because the workitem's id is always beginning with 1. there are many records in task table with workitemid = 1. then the exception(result returns more than one elements) happens.

this is by design to prevent such problems as when using human tasks (which can be active meaning not completed for very long time) it is highly recommended to use persistence on the engine side as well to guarantee the state (and its corresponding identifiers) is stored in reliable data store such as db.