Epinova.Elasticsearch icon indicating copy to clipboard operation
Epinova.Elasticsearch copied to clipboard

Error on stats tab

Open scrog opened this issue 11 months ago • 6 comments

Hi, We have a customer who have an issue with the production environment, when trying to access the stats tab there is an error: [ArgumentException: An item with the same key has already been added.] System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +60 System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) +5790801 System.Linq.Enumerable.ToDictionary(IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer) +302 Epinova.ElasticSearch.Core.EPiServer.Controllers.ElasticTrackingController.GetModel() in C:\projects\epinova-elasticsearch\src\Epinova.ElasticSearch.Core.EPiServer\Controllers\ElasticTrackingController.cs:45 Epinova.ElasticSearch.Core.EPiServer.Controllers.ElasticTrackingController.Index() in C:\projects\epinova-elasticsearch\src\Epinova.ElasticSearch.Core.EPiServer\Controllers\ElasticTrackingController.cs:33 lambda_method(Closure , ControllerBase , Object[] ) +87 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +35 System.Web.Mvc.Async.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39 System.Web.Mvc.Async.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult) +77 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42 System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__11_0() +72 System.Web.Mvc.Async.<>c__DisplayClass11_1.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +396 System.Web.Mvc.Async.<>c__DisplayClass11_1.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +396 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42 System.Web.Mvc.Async.<>c__DisplayClass3_6.<BeginInvokeAction>b__3() +50 System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__5(IAsyncResult asyncResult) +188 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38 System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +29 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +73 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +39 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38 System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +43 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +73 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +651 System.Web.<>c__DisplayClass285_0.<ExecuteStepImpl>b__0() +40 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +155 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +134

Any ideas?

Regards!

scrog avatar Mar 26 '24 08:03 scrog

Hi, No one who has any input on this?

Regards!

scrog avatar Apr 08 '24 08:04 scrog

Please validate that tracking table has the correct primary keys set. A similar error was fixed in https://github.com/Epinova/Epinova.Elasticsearch/commit/80f55d084d95e2492791ddd351f41f288d8ea1b9

The fix primary keys call will most likely fail if errors already exist in the table.

otanum avatar Apr 09 '24 09:04 otanum

Thanks! What can be done if error in primary keys are found?

Regards!

scrog avatar Apr 09 '24 11:04 scrog

The easiest solution is to empty the table.

If the search stats are really important you have to write query to locate the problems.

otanum avatar Apr 09 '24 11:04 otanum

Thanks, will look into it. Maybe will return with more questions :-)

scrog avatar Apr 09 '24 11:04 scrog

@otanum You where spot on, it was a duplicate in the tracking table, it was enough to remove that and everything started working again.

Thanks for your help!

scrog avatar Apr 12 '24 12:04 scrog