Tasks staying locked by a running workflow, and never unlocking.
This post discusses one of the possible cause of the error "This task is currently locked by a running workflow and cannot be edited", when tasks are part of a workflow. This message is expected when a workflow is running on the task, and has events to process. After processing the events, the task will be unlocked.
However, there might also be situations where tasks will stay locked forever.
How does this happen?
This behavior can typically happen when there is an issue while committing a workflow batch. Multiple workflow results are grouped together to be committed to the database in a single transaction. If an exception occurs while committing the transaction, the whole transaction will be cancelled. None of the results will be committed.
To verify if there was an error while committing the workflow results:
1) Increase the diagnostic level for the category “Workflow Infrastructure” to either High, Medium or Verbose
2) check the ULS logs for :
Windows SharePoint Services Workflow Infrastructure 72fe High
Error in commiting pending workflow batch items: Microsoft.SharePoint.SP
The 72fe does not necessarily mean tasks will stay locked, it just indicates a transaction did not succeed. Tasks can stay locked if this transaction contained the “unlocking” of the task (e.g. set the WorkflowVersion field back to 1).
So what shall I do next ?
Ideally, find the root cause of the 72fe tag, and eliminate them….
In case you do not want to investigate further, the safest might be to cancel the workflow on the item, and then restart it.
Note : in French, the error is: "Cette tâche est actuellement verrouillée par un flux de travail en cours d'exécution et ne peut pas être modifiée".
Thanks to Gyorgy Homolya for his help in writing this post.