Sunday, October 13, 2019

Sitecore 9 Initial Page Load Deadlock Senario

Recently we have upgraded a solution to Sitecore 9.1.1 and started facing an strange issue.

When we set the Sitecore instance to "ContentDelivery" role from web.config app settings property, front-end site's initial page load request takes ages to respond. After the initial respond site starts to work property.

I tried to look into the issue few days and still couldn't find a reason for the issue. Since this worked when sitecore role is set to "ContentManagement" role, debug or finding actual reason made much harder.

Finally we contacted Sitecore Support and they were able to find the reason for this.

According to Sitecore Support, there is a code deadlock scenario when EXM & FXM used together in Sitecore 9 versions.

Issue :
When the Sitecore role set to "ContentDelivery" in app settings, initial page request for the front-end site takes 15-30 minutes time to load.
Some have experience this same scenario on ContentManagement role as well as running on "Standalone" role.

Fix :

Sitecore.Support.329897.config
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <hooks>
<hook type="Sitecore.Owin.Authentication.Pipelines.CookieAuthentication.ValidateIdentity.CheckIdentityProvider, Sitecore.Owin.Authentication" resolve="true" patch:before = "*[1]" />
</hooks>
  </sitecore>
</configuration>


NOTE: This fix is a temporarily fix where it tries to find the erroneous request earlier in the request pipeline and will throw an error onto the logs once that captured.

Example Error on logs after this patch:

ERROR Hook object does not implement IHook. Config node: <hook type="Sitecore.Owin.Authentication.Pipelines.CookieAuthentication.ValidateIdentity.CheckIdentityProvider, Sitecore.Owin.Authentication" resolve="true" patch:source="Sitecore.Support.329897.config" xmlns:patch="http://www.sitecore.net/xmlconfig/" /> (method: Sitecore.Events.Hooks.HookManager.LoadAll()).
11020 11:52:51 ERROR Error loading hook: <hook type="Sitecore.Owin.Authentication.Pipelines.CookieAuthentication.ValidateIdentity.CheckIdentityProvider, Sitecore.Owin.Authentication" resolve="true" patch:source="Sitecore.Support.329897.config" xmlns:patch="http://www.sitecore.net/xmlconfig/" />
Exception: System.Exception
Message: Hook object does not implement IHook. Config node: <hook type="Sitecore.Owin.Authentication.Pipelines.CookieAuthentication.ValidateIdentity.CheckIdentityProvider, Sitecore.Owin.Authentication" resolve="true" patch:source="Sitecore.Support.329897.config" xmlns:patch="http://www.sitecore.net/xmlconfig/" /> (method: Sitecore.Events.Hooks.HookManager.LoadAll()).
Source: Sitecore.Events.Hooks.HookManager.LoadAll()

According to Sitecore Support, this issue should be patched/fixed with upcoming Sitecore 9.3 release