SQL Workflow Instance Store locks to expire unexpectedly in a Microsoft .NET Framework 4.0 application that uses Windows Workflow Foundation


Symptoms


In Windows Workflow Foundation, a service host throws the following InstancePersistenceException exception:

The SqlWorkflowInstanceStore lock has expired. This could have occurred because the SQL Server is busy or because the connection was temporarily lost.

This exception is thrown even the Microsoft SQL Server is not busy or experiencing any resource issues. Shortly after the exception is thrown, the service host faults with the following error message:

Failed to extend lock expiration, lock expiration already passed or the lock owner was deleted. Aborting SqlWorkflowInstanceStore.

Cause


This issue occurs because the  system time jumped ahead by more than 30 seconds.

To verify this behavior, check the event log for the following entry:

The system time was changed.
Subject:
                Security ID:            LOCAL SERVICE
                Account Name:       LOCAL SERVICE
                Account Domain:     NT AUTHORITY
                Logon ID:                0x3e5
Process Information:
                Process ID:             0x330
                Name:                   C:\Windows\System32\svchost.exe
Previous Time:                       ?2009?-?11?-?12T08:29:17.598587800Z
New Time:                             ?2009?-?11?-?12T08:34:05.974883600Z

Note System time jumps may occur if you employ the Windows Time Service. By default, the Windows Time Service resets the system clock if the clock skew is larger than 5 minutes.

Resolution


To resolve this issue, verify that you have correctly configured your domain controller. System time jumps should not occur if you employ a correctly configured domain controller, and the Windows Time Service is set the default configuration.