Workflow Ownership Exception
Last changed: -

A WorkflowOwnershipException is reaised when the workflow runtime tries to either load or persist a workflow that is no longer owns.

The ownership periode of a workflow is determined by the instanceOwnershipDuration paramater of the SqlWorkflowPersistenceService constructor. If this periode has passed the runtime is no longer considered the owner and another runtime os free to load the workflow instance. Additionally if the original runtime will had the workflow loaded and tries to save it a WorkflowOwnershipException will be raised.

Calling GetWorkflow to can cause a workflow to be loaded into memory. If the SqlWorkflowPersistenceService is configured with UnloadOnIdle set to true you might expect the workflow to be unloaded automatically but this only happens when the workflow becomes idle. If no activities are executed inside of the workflow it never becomes idle, after all it was idle all the time, and the persistence service never releases its lock on the record.