"Failed to extend contact lease" exception occurs if large amount of pages are requested within a single interaction


Description

A "Failed to extend contact lease" error might occur if a large number of pages were requested within a single interaction.

The following exception can be found in the Sitecore XP log:

316 2017:12:10 16:05:50 ERROR Cannot finish Analytics page tracking
Exception: Sitecore.Analytics.Exceptions.ContactLockException
Message: Failed to extend contact lease for contact ce9c9d9e-2d42-4b82-a871-1a2dd96f050e
Source: Sitecore.Analytics
   at Sitecore.Analytics.Tracking.ContactManager.SaveAndReleaseContact(Contact contact)
   at Sitecore.Analytics.Pipelines.EndAnalytics.ReleaseContact.Process(PipelineArgs args)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, Boolean failIfNotExists)
   at Sitecore.Analytics.Pipelines.EndAnalytics.EndAnalyticsPipeline.Run()
   at Sitecore.Analytics.Pipelines.HttpRequest.EndAnalytics.Process(HttpRequestArgs args)
Exception is thrown for each next page

Important Note

The same error can be a result of an incorrect Session State configuration.

Before applying the patch, ensure that both Shared Session State and Private Session State are configured properly according to the following documentation: Session state configuration scenarios.

Solution

To resolve the issue, consider one of the following options: