Bevin
Bevin

Reputation: 173

Sitecore.Analytics.Exceptions.ContactLockException while merging contacts

I am using Sitecore 8.0 update 5, While I try to Identify the contact using

Tracker.Current.Session.Identify(userKey);

I get the error

Sitecore.Analytics.Exceptions.ContactLockException

Adding the whole stack trace below

Exception: Sitecore.Analytics.Exceptions.ContactLockException
Message: Contact 1cd840a6-f367-4b5f-9df1-74240a03fd29 could not be locked in the XDB.
Source: Sitecore.Analytics
   at Sitecore.Analytics.Tracking.StandardSession.Identify(String userName)
   at Test.Client.Common.Utilities.AnalyticsHelper.MergeContacts(String userKey)

Upvotes: 0

Views: 1953

Answers (2)

Mohit Dharmadhikari
Mohit Dharmadhikari

Reputation: 4110

This is code from Brain's Pedersen.

// THIS IS BAD!!!
// The user could be extranet\anonymous
if (!Tracker.IsActive)
  return;
Tracker.Current.Session.Identify(Sitecore.Context.User.Name);

// THIS COULD BE A SOLUTION:
if (!Tracker.IsActive)
  return;
if (Sitecore.Current.User.Name.ToLower() == "extranet\\anonymous")
  return;
Tracker.Current.Session.Identify(Sitecore.Context.User.Name);

// OR MAYBE THIS?
if (!Tracker.IsActive)
  return;
if (!Sitecore.Context.User.IsAuthenticated)
  return;
Tracker.Current.Session.Identify(Sitecore.Context.User.Name);

You can go through the link for more details. https://briancaos.wordpress.com/2015/07/02/sitecore-8-and-tracker-current-session-identify-overriding-expired-contact-session-lock-for-contact-id/

Upvotes: 2

Rodrigo Peplau
Rodrigo Peplau

Reputation: 180

This seems to be an issue with your MongoDB. Check if it's running and if it's reachable to your IIS machine. Also check your log for Mongo erros.

Here is a similar issue: https://community.sitecore.net/developers/f/8/t/1771

Upvotes: 0

Related Questions