Causes for ContactLockException error


Description

The ContactLockException error is an exception that can occur in the process of locking a Sitecore XP contact.

In Sitecore XP, a web-cluster or an out of request worker can lock a contact. Only the owner of the lock can modify contact data. Locks were introduced to avoid data corruption when there are multiple threads trying to modify the same contact's data at the same time.

Note: In Sitecore XP 9.0 and later versions, contacts are no longer locked, and the ContactLockException error therefore does not occur.

Locks have a timeout setting. When a web-cluster locks a contact, the web-cluster has to extend the lock from time to time to keep the contact locked while the contact is active on a website. The lock remains until the contact data is saved to the database at the end of the contact's sessions with the website.

There are several scenarios that can result in a ContactLockException error:

Solution

We recommend two ways to avoid these exceptions: