Might be a bug that’s been outstanding for many years. You can try adding externalHandlerSeparateThread to the task definition with a value of false.
I had posted here: Identity Refresh in Joiner Workflow throws a Identity Lock error - #16 by phodgdon