After the upgrade, with some custom code also added, we started to get an issue with the Glass Mapper implemented solution, where the front-end website just throw an error and just dies. We were able to login to Backend Sitecore without any issues.
Following popup message is the only thing we get and site just throw this error continuously until we do an IIS reset.
Front-End Website Error Popup |
There were nothing in the Sitecore Logs too related to this error.
But we could see following error on Windows event logs, which does not provide any useful information.
Faulting application name: w3wp.exe, version: 10.0.17134.1, time stamp: 0xed729d4eFaulting module name: clr.dll, version: 4.7.3416.0, time stamp: 0x5cabfc63Exception code: 0xc00000fdFault offset: 0x00000000000f503fFaulting process ID: 0x35b4Faulting application start time: 0x01d53db16c6f9a75Faulting application path: c:\windows\system32\inetsrv\w3wp.exeFaulting module path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dllReport ID: a175fc77-b1fd-4370-bee8-f2dd927f34daFaulting package full name:
So, we go a memory dump and was able to see following error was thrown with StackOverflow exception. This below error was throwing over and over again.
.........Glass.Mapper.Sc.SitecoreService.RunCreateType(Sitecore.Data.Items.Item, Glass.Mapper.GetOptions, System.Collections.Generic.Dictionary`2<System.String, System.Object>)Glass.Mapper.Sc.LazyItemEnumerable`1[[System.__Canon, mscorlib]].ProcessItems()mscorlib_ni!System.Lazy`1[System.__Canon].CreateValue()$##6000F19+ecmscorlib_ni!System.Lazy`1[System.__Canon].LazyInitValue()$##6000F18+b8Glass.Mapper.Sc.LazyItemEnumerable`1[[System.__Canon, mscorlib]]..ctor(Glass.Mapper.Sc.GetItemsOptions, Glass.Mapper.Sc.ISitecoreService, Glass.Mapper.LazyLoadingHelper)DynamicClass.lambda_method(System.Runtime.CompilerServices.Closure, System.Object[])Glass.Mapper.Utilities.CreateGenericType(System.Type, System.Type[], System.Object[])Glass.Mapper.Sc.SitecoreService.GetItems(Glass.Mapper.Sc.GetItemsOptions)Glass.Mapper.AbstractDataMapper.MapCmsToProperty(Glass.Mapper.AbstractDataMappingContext)Glass.Mapper.Configuration.AbstractTypeConfiguration.MapPropertiesToObject(System.Object, Glass.Mapper.IAbstractService, Glass.Mapper.AbstractTypeCreationContext)Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CreateConcrete.CreateConcreteTask.CreateObjectAndMapProperties(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CreateConcrete.CreateConcreteTask.Execute(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Sc.Pipelines.ObjectConstruction.EnforcedTemplateCheck.PerformTemplateCheck(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs, Sitecore.Data.ID, Glass.Mapper.Sc.Configuration.SitecoreEnforceTemplate)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CacheCheck.CacheCheckTask.Execute(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Sc.Pipelines.ObjectConstruction.SitecoreItemTask.Execute(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Sc.Pipelines.ObjectConstruction.NullItemTask.Execute(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.AbstractPipelineRunner`2[[System.__Canon, mscorlib], [System.__Canon, mscorlib]].Run(System.__Canon)Glass.Mapper.AbstractService.InstantiateObject(Glass.Mapper.AbstractTypeCreationContext)Glass.Mapper.Sc.SitecoreService.RunCreateType(Sitecore.Data.Items.Item, Glass.Mapper.GetOptions, System.Collections.Generic.Dictionary`2<System.String, System.Object>)Glass.Mapper.AbstractDataMapper.MapCmsToProperty(Glass.Mapper.AbstractDataMappingContext)Glass.Mapper.Configuration.AbstractTypeConfiguration.MapPropertiesToObject(System.Object, Glass.Mapper.IAbstractService, Glass.Mapper.AbstractTypeCreationContext)Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CreateConcrete.CreateConcreteTask.CreateObjectAndMapProperties(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CreateConcrete.CreateConcreteTask.Execute(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Sc.Pipelines.ObjectConstruction.EnforcedTemplateCheck.PerformTemplateCheck(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs, Sitecore.Data.ID, Glass.Mapper.Sc.Configuration.SitecoreEnforceTemplate)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CacheCheck.CacheCheckTask.Execute(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Sc.Pipelines.ObjectConstruction.SitecoreItemTask.Execute(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Sc.Pipelines.ObjectConstruction.NullItemTask.Execute(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.AbstractPipelineRunner`2[[System.__Canon, mscorlib], [System.__Canon, mscorlib]].Run(System.__Canon)Glass.Mapper.AbstractService.InstantiateObject(Glass.Mapper.AbstractTypeCreationContext)Glass.Mapper.Sc.SitecoreService.RunCreateType(Sitecore.Data.Items.Item, Glass.Mapper.GetOptions, System.Collections.Generic.Dictionary`2<System.String, System.Object>)Glass.Mapper.Sc.SitecoreService.GetItem[[System.__Canon, mscorlib]](Glass.Mapper.Sc.GetItemOptions) ................
After few days of investigation, we were lucky enough to see some code part in our solution that might caused this. It was actually a LazyLoad setting setup for InferType properties in the base Glass model. From our code, we have disabled LazyLoading for InterType which caused the Glass Mapper to load all the parent/children items for Parents/Children InferType property defined in the Glass Base mode.
public GetItemByIdOptions CreateGetItemByIdOptions(Guid id) => new GetItemByIdOptions(id) { InferType = true, Lazy = Glass.Mapper.LazyLoading.Disabled };
Once we adjusted that "Lazy" setting to "Enabled" (see below), site starts to load without any issue again.
public GetItemByIdOptions CreateGetItemByIdOptions(Guid id) => new GetItemByIdOptions(id) { InferType = true, Lazy = Glass.Mapper.LazyLoading.Enabled };
Special thanks for Kamruz Jaman & Mike Renolds in Sitecore community to helping out with this issue with suggestions and time.
Hope this will help someone.. :-)
References :
This should be another reason for your Sitecore 9 site not loading - https://medium.com/@markgibbons25/sitecore-crashing-on-startup-with-internal-error-in-the-net-runtime-be5831e94b6e
Happy Sitecore!!!