Friday, November 8, 2019

Sitecore 9 GEO IP Service Fails When xConnect is Down

Just wanted to share small but valuable point I learned recently.

We faced a same issue on two of my client's site implementations where their home pages takes 10-15 seconds load. But the other pages inside the site loads without any delays.

We were in contact with Sitecore for this issue and then we got an answer from Sitecore consultancy team.

The issue was related to GEO IP lookup service & xConnect.

On both the solutions I worked, there is a GEO IP lookup call happening on the home page to redirect visitors to their relevant regions.

But due to different reasons (rebooting the xConnect server for maintenance, etc), both of those sites xConnect site was down.

So, when the xConnect is down, GEO IP lookup requests fails to work as required and tries several times to fetch the correct information for the IP. After several attempts it gets failed.
Due to this delay of trying to fetch the IP several times due to failures, home page gets delay to load.

I don't know exact reason why GEO IP lookup needs xConnect site running, but will update here if I find it in future.

Thank you for Sitecore for helping us to find this issue.

Happy Sitecore!!

Thursday, November 7, 2019

Path Analyzer Map Errors Populating Sitecore Logs After Sitecore 9.1 Upgrade

Recently we upgraded a Sitecore 8.1 solution to Sitecore 9.1 Update-1

After the upgrade we rebuild the reporting database. After the reporting database rebuild we started to notice that our Sitecore logs (setup to log level "ERROR") is getting populated with lot of Path Analyzer errors.

7404 18:45:08 ERROR [Path Analyzer] Cannot apply rule on the interaction.
Exception: Sitecore.XConnect.Segmentation.ExpressionBuilder.PredicateDescriptorException
Message: No known predicate type could be determined from ' Sitecore.Analytics.Rules.Conditions.ContactVisitIndexCondition,Sitecore.Analytics' specified in the definition item (Id = '61370693-189d-44a0-abc5-2592dbd579ed', db = 'master') : Could not load type 'Sitecore.Analytics.Rules.Conditions.ContactVisitIndexCondition' from assembly 'Sitecore.Analytics'.
Source: Sitecore.Marketing.Segmentation.xMgmt
   at Sitecore.Marketing.Segmentation.ExpressionBuilder.ContentTreePredicateDescriptorLocator.GetDescriptor(Guid id)
   at Sitecore.Marketing.Segmentation.RuleXmlConverter.ConditionXmlNodeConverter.LookupType(Guid descriptorId)
   at Sitecore.Marketing.Segmentation.RuleXmlConverter.ConditionXmlNodeConverter.ConvertNodeInternal(INodeConversionContext`2 context, XElement element)
   at Sitecore.Marketing.Segmentation.RuleXmlConverter.BaseXmlRuleNodeConverter`1.Convert(INodeConversionContext`2 context, XElement node)
   at Sitecore.Marketing.Segmentation.RuleXmlConverter.AndXmlNodeConverter.ConvertNodeInternal(INodeConversionContext`2 context, XElement element)
   at Sitecore.Marketing.Segmentation.RuleXmlConverter.BaseXmlRuleNodeConverter`1.Convert(INodeConversionContext`2 context, XElement node)
   at Sitecore.XConnect.Segmentation.ExpressionBuilder.TreeConverter.TreeConverter`2.Convert(TFromNode treeRoot)
   at Sitecore.Marketing.Segmentation.RuleXmlConverter.RuleXmlConverter.CreateRule(XElement ruleElement)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Sitecore.PathAnalyzer.Rules.RulesBuilder.BuildXmlRules(String rulesXml)
   at Sitecore.PathAnalyzer.Rules.RulesBuilder.BuildRules(String rulesXml)
   at Sitecore.PathAnalyzer.Rules.RulesValidator.ValidateRule(Interaction interaction, String rulesXml, ConditionParameters parameters)
   at Sitecore.PathAnalyzer.Construction.TreeBuilder.IsApplicable(Interaction interaction, String rulesXml, ConditionParameters conditionParameters)
Nested Exception
Exception: System.TypeLoadException
Message: Could not load type 'Sitecore.Analytics.Rules.Conditions.ContactVisitIndexCondition' from assembly 'Sitecore.Analytics'.
Source: mscorlib
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
   at System.Type.GetType(String typeName, Boolean throwOnError)
   at Sitecore.Marketing.Segmentation.ExpressionBuilder.ContentTreePredicateDescriptorLocator.GetDescriptor(Guid id)

Unsure if following steps did help, but anyways mentioning them also :

  • Since the item ID mentioned in the error was "/sitecore/system/Settings/Rules/Definitions/Elements/Visitor/Global Visit No", I did try to remove/clean all the items that used this rule 
  • Deleted all the custom Maps from Sitecore 8.1
  • Cleared all the table in the RefData database and Deploy all the Marketing Definitions again
  • Removing EMPTY Site definition entry in "SiteNames" table in Reporting database entry that I removed was SiteNameId was set to 0 & SiteName was empty


But all the above steps did not stopped the error population on the logs.


Then I did the following steps and after the last step the error went away.

Step 1: Delete all the Map definitions from "TreeDefinitions" table in Reporting database

Step 2: Redeploy all Path Analyzer Map definitions by visiting following tool and clicking "Deploy all maps that are not deployed" button
http:/<sitecore_hostname>/Sitecore/admin/pathanalyzer.aspx

Step 3: In the same tool above, click "Rebuild" button on "Historic Map Rebuild" section

NOTE: These were mainly taking from https://sitecore.stackexchange.com/questions/17162/sitecore-9-processing-server-exception-when-executing-agent-pathanalyzer-mapre post on Sitecore StackExchange


Some useful links related to Sitecore Path Analyzer Errors on Log files :

https://sitecore.namics.com/2019/08/14/sitecore-pathanalyzer-undeploy-maps/
https://sitecore.stackexchange.com/questions/11253/no-known-predicate-type-could-be-determined-from-sitecore-analytics-omnichannel
https://blog.wesleylomax.co.uk/posts/2019-08-08-sitecore-9-1-processing-server-an-error-occured-evaluating-the-primary-condition-of-the-rule/