Description
If you are seeing a high count of the exception type "TaskCanceledException" with "EPiServer.Find.Api.Command.GetResponse" in the stack trace, there could be threadpool starvation (a performance issue) and the search functionality may not be behaving asynchronously.
Example error:
System.AggregateException: One or more errors occurred. (A task was canceled.) (A task was canceled.)
---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at EPiServer.Find.Api.Command.GetResponse[TResult](IJsonRequest request)
at EPiServer.Find.Api.MultiSearchCommand`1.Execute()
at EPiServer.Find.Client.MultiSearch[TResult](IEnumerable`1 searchRequests, Action`1 commandAction)+MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at EPiServer.Find.Cms.SearchRequestExtensions.GetContentResult[TContentData](IMultiSearch`1 multiSearch, Int32 cacheForSeconds, Boolean cacheForEditorsAndAdmins)
Steps
If this error is occurring, ensure that the async search methods are used and that the Episerver.Find nuget package is on at least 16.5.0.
Please see the following for the async search methods:
https://world.optimizely.com/blogs/manh-nguyen/dates/2024/7/asynchronous-search-with-optimizely/
Please sign in to leave a comment.