ContentLoader GetItems Random Exceptions

Vote:
 

Hello,

Using EPiServer Commerce 12.17.2, we get different random exceptions when we call contentLoader.GetItems as following:

IEnumerable<ContentReference> contentLinks = contentLoader.GetDescendents(referenceConverter.GetRootLink());
var items = contentLoader.GetItems(contentLinks, CultureInfo.GetCultureInfo(defaultLanguage));

    This code is running at the end of a custom product feed import schedule job.

    Exception1:

    Thread was being aborted. Exception in ecf_CatalogEntry_List: at Mediachase.Data.Provider.SqlDataProvider.LoadDataSet(DataCommand command)
    at Mediachase.Commerce.Catalog.Data.CatalogEntryAdmin.LoadByList(IEnumerable`1 catalogEntryIds, Nullable`1 responseGroup)
    at Mediachase.Commerce.Catalog.Managers.CatalogEntryManager.<>c__DisplayClass44_0.<ExecuteDtoThroughCache>b__0()
    at Mediachase.Data.Provider.Internal.Extensions.ObjectInstanceCacheExtensions.ReadThrough[T](IObjectInstanceCache cache, ReadMode readMode, String cacheKey, Func`1 load, Func`2 evictionPolicy)
    at Mediachase.Data.Provider.Internal.Extensions.ObjectInstanceCacheExtensions.ReadThrough[T](IObjectInstanceCache cache, ReadMode readMode, String cacheKey, Func`1 load, IEnumerable`1 masterKeys, TimeSpan duration)
    at Mediachase.Commerce.Catalog.CatalogCache.ReadThrough[T](ReadMode readMode, String key, IEnumerable`1 masterKeys, TimeSpan timeout, Func`1 load)
    at Mediachase.Commerce.Catalog.Managers.CatalogEntryManager.ExecuteDtoThroughCache(ReadMode readMode, String cacheKey, IEnumerable`1 masterKeys, Action`1 adminAction, TimeSpan timeout)
    at Mediachase.Commerce.Catalog.Managers.CatalogEntryManager.GetCatalogEntriesDto(Int32[] catalogEntries, CatalogEntryResponseGroup responseGroup, ReadMode readMode, TimeSpan cacheTimeout)
    at EPiServer.Commerce.Catalog.Provider.Construction.EntryBuilder.Create(IList`1 contentLinks, String language)
    at EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.ConstructContent(IList`1 contentLinks, Func`3 createContentFunc)
    at EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.LoadSpecificContentInstances(IList`1 contentLinks, String language)
    at EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.BatchLoad(IList`1 contentLinks, Func`2 dbLoader)
    at EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.LoadContents(IList`1 contentReferences, ILanguageSelector selector)
    at EPiServer.Core.ContentProvider.GetContentBatch(IList`1 batch, ILanguageSelector selector, List`1& contents, Dictionary`2& contentMap)
    at EPiServer.Core.ContentProvider.GetScatteredContents(IEnumerable`1 contentLinks, ILanguageSelector selector)
    at EPiServer.Core.Internal.ProviderPipelineImplementation.GetItems(ContentProvider provider, IList`1 contentLinks, LoaderOptions loaderOptions)
    at EPiServer.Core.Internal.DefaultContentLoader.GetItems(IEnumerable`1 contentLinks, LoaderOptions loaderOptions)

    Exception2:

    Thread was being aborted. at System.Data.Common.Int32Storage.Get(Int32 record)
    at System.Data.DataRow.get_Item(DataColumn column)
    at Mediachase.Commerce.Catalog.Dto.CatalogRelationDto.System.Data.Common.Int32Storage.Get(Int32 record)
    at System.Data.DataRow.get_Item(DataColumn column)
    at Mediachase.Commerce.Catalog.Dto.CatalogRelationDto.NodeEntryRelationRow.get_CatalogEntryId()()
    at EPiServer.Commerce.Catalog.Provider.Construction.EntryBuilder.<>c__DisplayClass13_0.<GetParentlink>b__0(NodeEntryRelationRow x)
    at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
    at EPiServer.Commerce.Catalog.Provider.Construction.EntryBuilder.GetParentlink(Int32 catalogId, Int32 catalogEntryId, IEnumerable`1 entryNodeRelations)
    at EPiServer.Commerce.Catalog.Provider.Construction.EntryBuilder.ConstructEntries(CatalogEntryDto entryDto, IDictionary`2 versionsForUnpublishedContent, IList`1 entryNodeRelations, String language)
    at EPiServer.Commerce.Catalog.Provider.Construction.EntryBuilder.Create(IList`1 contentLinks, String language)
    at EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.ConstructContent(IList`1 contentLinks, Func`3 createContentFunc)
    at EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.LoadSpecificContentInstances(IList`1 contentLinks, String language)
    at EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.BatchLoad(IList`1 contentLinks, Func`2 dbLoader)
    at EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.LoadContents(IList`1 contentReferences, ILanguageSelector selector)
    at EPiServer.Core.ContentProvider.GetContentBatch(IList`1 batch, ILanguageSelector selector, List`1& contents, Dictionary`2& contentMap)
    at EPiServer.Core.ContentProvider.GetScatteredContents(IEnumerable`1 contentLinks, ILanguageSelector selector)
    at EPiServer.Core.Internal.ProviderPipelineImplementation.GetItems(ContentProvider provider, IList`1 contentLinks, LoaderOptions loaderOptions)
    at EPiServer.Core.Internal.DefaultContentLoader.GetItems(IEnumerable`1 contentLinks, LoaderOptions loaderOptions)

    Exception3:

    Thread was being aborted. at System.Globalization.CompareInfo.InternalFindNLSStringEx(IntPtr handle, IntPtr handleOrigin, String localeName, Int32 flags, String source, Int32 sourceCount, Int32 startIndex, String target, Int32 targetCount)
    at System.Globalization.CompareInfo.IsPrefix(String source, String prefix, CompareOptions options)
    at EPiServer.Commerce.Catalog.Provider.Construction.CatalogPropertyLoader.AddMetaDataAttributePropertyValues(MetaObjectAccessor accessor, CatalogContentBase content)
    at EPiServer.Commerce.Catalog.Provider.Construction.CatalogPropertyLoader.LoadProperties(CatalogEntryRow entryRow, CatalogItemSeoRow seoRow, VariationRow variationRow, EntryContentBase content, MetaObjectAccessor metaObjectAccessor)
    at EPiServer.Commerce.Catalog.Provider.Construction.EntryBuilder.ConstructEntries(CatalogEntryDto entryDto, IDictionary`2 versionsForUnpublishedContent, IList`1 entryNodeRelations, String language)
    at EPiServer.Commerce.Catalog.Provider.Construction.EntryBuilder.Create(IList`1 contentLinks, String language)
    at EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.ConstructContent(IList`1 contentLinks, Func`3 createContentFunc)
    at EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.LoadSpecificContentInstances(IList`1 contentLinks, String language)
    at EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.BatchLoad(IList`1 contentLinks, Func`2 dbLoader)
    at EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.LoadContents(IList`1 contentReferences, ILanguageSelector selector)
    at EPiServer.Core.ContentProvider.GetContentBatch(IList`1 batch, ILanguageSelector selector, List`1& contents, Dictionary`2& contentMap)
    at EPiServer.Core.ContentProvider.GetScatteredContents(IEnumerable`1 contentLinks, ILanguageSelector selector)
    at EPiServer.Core.Internal.ProviderPipelineImplementation.GetItems(ContentProvider provider, IList`1 contentLinks, LoaderOptions loaderOptions)
    at EPiServer.Core.Internal.DefaultContentLoader.GetItems(IEnumerable`1 contentLinks, LoaderOptions loaderOptions)

    Exception4: 

    Thread was being aborted. at SNIReadSyncOverAsync(SNI_ConnWrapper* , SNI_Packet** , Int32 )
    at SNINativeMethodWrapper.SNIReadSyncOverAsync(SafeHandle pConn, IntPtr& packet, Int32 timeout)
    at System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync()
    at System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket()
    at System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer()
    at System.Data.SqlClient.TdsParserStateObject.TryReadByte(Byte& value)
    at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
    at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
    at System.Data.SqlClient.SqlDataReader.get_MetaData()
    at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
    at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
    at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
    at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
    at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
    at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
    at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
    at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
    at EPiServer.DataAccess.Internal.PropertyDefinitionDB.<>c__DisplayClass46_0.<ListDataSetFromDb>b__0()
    at EPiServer.Data.Providers.Internal.SqlDatabaseExecutor.<>c__DisplayClass31_0`1.<Execute>b__0()
    at EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute[TResult](Func`1 method)
    at EPiServer.DataAccess.Internal.PropertyDefinitionDB.ListFromDb(Int32 contentTypeID)
    at EPiServer.DataAbstraction.Internal.DefaultPropertyDefinitionRepository.List(Int32 contentTypeID)
    at EPiServer.DataAbstraction.Internal.DefaultContentTypeRepository.MergeModelAndProperties(ContentType clone)
    at EPiServer.DataAbstraction.Internal.DefaultContentTypeRepository.EnsureMergedInstance(ContentType contentType)
    at EPiServer.Commerce.Catalog.Provider.Construction.MetaClassContentFactory.Create(Type type, String language, Nullable`1 catalogId)
    at EPiServer.Commerce.Catalog.Provider.Construction.MetaClassContentFactory.Create(String baseEntryType, Int32 metaClassId, String language, Nullable`1 catalogId)
    at EPiServer.Commerce.Catalog.Provider.Construction.EntryBuilder.GetCatalogContent(String entryType, Int32 metaClassId, String language, Int32 catalogId)
    at EPiServer.Commerce.Catalog.Provider.Construction.EntryBuilder.<>c__DisplayClass7_0.<ConstructEntries>b__0(CatalogEntryRow x)
    at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
    at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
    at System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
    at System.Linq.GroupedEnumerable`3.GetEnumerator()
    at EPiServer.Commerce.Catalog.Provider.Construction.EntryBuilder.ConstructEntries(CatalogEntryDto entryDto, IDictionary`2 versionsForUnpublishedContent, IList`1 entryNodeRelations, String language)
    at EPiServer.Commerce.Catalog.Provider.Construction.EntryBuilder.Create(IList`1 contentLinks, String language)
    at EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.ConstructContent(IList`1 contentLinks, Func`3 createContentFunc)
    at EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.LoadSpecificContentInstances(IList`1 contentLinks, String language)
    at EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.BatchLoad(IList`1 contentLinks, Func`2 dbLoader)
    at EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.LoadContents(IList`1 contentReferences, ILanguageSelector selector)
    at EPiServer.Core.ContentProvider.GetContentBatch(IList`1 batch, ILanguageSelector selector, List`1& contents, Dictionary`2& contentMap)
    at EPiServer.Core.ContentProvider.GetScatteredContents(IEnumerable`1 contentLinks, ILanguageSelector selector)
    at EPiServer.Core.Internal.ProviderPipelineImplementation.GetItems(ContentProvider provider, IList`1 contentLinks, LoaderOptions loaderOptions)
    at EPiServer.Core.Internal.DefaultContentLoader.GetItems(IEnumerable`1 contentLinks, LoaderOptions loaderOptions)

    Any idea what the issue would be?

    Thanks!

    #214647
    Jan 09, 2020 22:17
    Vote:
     

    It looks like you are loading too much in one go. A better approach is to load the items by batches. GetItems has another overload to support that

    #214649
    Jan 10, 2020 3:35
    Islam Hamed - Jan 16, 2020 17:57
    Thanks Quan - The issue was with app pool being recycled suddenly resulting in calling our feed clean up module which it is not ready yet.
    * You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.