Intermittent data source errors occurring on report

2 posts, 0 answers
  1. Anil
    Anil avatar
    5 posts
    Member since:
    Sep 2018

    Posted 27 Sep 2018 Link to this post

    One of the reports on my company's product, which uses Telerik Reporting R3 2016, is intermittently generating an error about resolving the dsGiftCard object data source that it uses. Sometimes, the report viewer says that it is unable to create a report instance, while other times it says that it is unable to get the parameters. The error only occurs on our deployments and not on our local builds. Our local builds load the report much faster. Usually the report loads fine, but this error generates on such a random basis my team is having trouble tracking it and finding out the cause. We're hoping someone here at Telerik can help us resolve this issue.

    exceptionMessage: "An error has occurred while resolving 'dsGiftCard' data source: An error occurred while invoking data retrieval method."
    exceptionType: "Telerik.Reporting.Processing.Data.ObjectDataSourceException"
    message: "An error has occurred."
    stackTrace: " at Telerik.Reporting.Processing.Data.ObjectDataSourceInstanceResolver.TryResolveAsMethodInvocationOnTarget(Type type, Func`1 resolveTarget, String dataMember, ObjectDataSourceParameterCollection parameters, Object& result) ↵ at Telerik.Reporting.Processing.Data.ObjectDataSourceInstanceResolver.TryResolveAsMethodInvocation(Object dataSource, String dataMember, ObjectDataSourceParameterCollection parameters, Object& instance) ↵ at Telerik.Reporting.Processing.Data.ObjectDataSourceInstanceResolver.ResolveDataSource(Object dataSource, String dataMember, Boolean evaluateParametersValues) ↵ at Telerik.Reporting.Processing.Data.ObjectDataProviderBase`1.ResolveDataSource() ↵ at Telerik.Reporting.Processing.Data.ObjectDataEnumerable.ResolveEnumerable() ↵ at Telerik.Reporting.Processing.Data.ObjectDataEnumerableBase.GetEnumerator() ↵ at Telerik.Reporting.Processing.Data.SeedDataAdapter.GroupData(IEnumerable`1 rawData) ↵ at Telerik.Reporting.Processing.Data.SeedDataAdapter.Execute(IEnumerable`1 data) ↵ at Telerik.Reporting.Processing.Data.ResultSetAdapter.Execute(IEnumerable`1 data) ↵ at Telerik.Reporting.Processing.Data.MultidimentionalDataProvider.Execute(MultidimensionalQuery query) ↵ at Telerik.Reporting.Processing.ReportParametersManager`1.CalculateParameterProperties(P parameter, IReportParameter parameterDef, IDictionary`2 parameterValues) ↵ at Telerik.Reporting.Processing.ReportParametersManager`1.Calculate(P parameter, IDictionary`2 parameterValues) ↵ at Telerik.Reporting.Processing.ReportParametersManager`1.CalculateChildren(P parameter, IDictionary`2 parameterValues) ↵ at Telerik.Reporting.Processing.ReportParametersManager`1.CalculateParameters(IDictionary`2 parameterValues) ↵ at Telerik.Reporting.Processing.DocumentParametersManager`1.CalculateParameters(IDictionary`2 values, Boolean ensureCalculated) ↵ at Telerik.Reporting.Processing.DocumentParametersManager`1.GetMergedParameters(IDictionary`2 values) ↵ at Telerik.Reporting.Services.WebApi.ReportsControllerBase.GetParameters(String clientID, ClientReportSource reportSource) ↵ at lambda_method(Closure , Object , Object[] ) ↵ at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters) ↵ at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken) ↵--- End of stack trace from previous location where exception was thrown --- ↵ at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) ↵ at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) ↵ at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext() ↵--- End of stack trace from previous location where exception was thrown --- ↵ at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) ↵ at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) ↵ at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext() ↵--- End of stack trace from previous location where exception was thrown --- ↵ at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) ↵ at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) ↵ at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()"

     

    Here is the C# method that the data source gets its data from:

    public static DataTable RunReport(string sessionId, string paramsJson, int tableIndex, int? savedDataId, int reportId)
            {
                Stopwatch sw = new Stopwatch();
                sw.Start();
                DataSet ds = null;
                DataSet dsCache = null;
     
                try
                {
                    var appSettings = new AppSettings();
                    var expires = appSettings.Get("Cache.ExpirationInSeconds", 2);
                    var urn = UrnId.CreateWithParts(sessionId, reportId.ToString(), paramsJson.GetHashCode().ToString());
                    dsCache = _memCache.Get<DataSet>(urn);
                    if (dsCache != null)
                    {
                        _memCache.Replace(urn, dsCache, TimeSpan.FromSeconds(expires));
                        Log.Debug("Data found in cache");
                        return dsCache.Tables[tableIndex];
                    }
                      
     
     
                    ICacheClient cacheClient = null;
                    if (appSettings.Get("Cache.Provider", "memory").ToLower() == "memory")
                        cacheClient = new MemoryCacheClient();
                    else
                        cacheClient = AwsDynamoDbLogic.GetGenericDynamoDbCacheClient(AwsDynamoDbLogic.ResolveAwsDynamoDbSettings(new AppSettings()));
                    var cdp = ConnectionDataProviderFactory.TryResolve(sessionId, cacheClient, appSettings);
     
                    var dialectProvider = new MeevoSqlServerOrmLiteDialectProvider(() => cdp);
                    var fac = new ReportDbConnectionFactory(cdp, dialectProvider);
     
                    var repo = new ReportRepository(fac);
                    var logic = new ReportLogic(repo);
     
                    ds = AsyncContext.Run(() => logic.RunReportAsync(reportId, CancellationToken.None, paramsJson)) as DataSet;
     
                    //Remove by pattern will enumerate through entire dictionary and remove all entries that have expired or macth the regex
                    //lINE 331
                    _memCache.RemoveByPattern("{0}*".Fmt(UrnId.CreateWithParts(sessionId)));
     
     
     
                    _memCache.Add(urn, ds, TimeSpan.FromSeconds(expires));
     
                    Log.Debug("Count of data sets is: " + ds?.Tables?.Count);
     
                    if (ds == null)
                        Log.Debug("Data set is null");
                          
                    return ds.Tables[tableIndex];
                }
                catch (Exception ex)
                {
                    Log.Error("Source:\n" + ex.Source
                        + "\n\nTarget Site:" + ex.TargetSite
                        + "\n\nStack trace:\n" + ex.StackTrace
                        + "\nReport ID: " + reportId.ToString()
                        + "\nJson parameters: " + paramsJson
                        + "\nTable index: " + tableIndex
                        + "\n\nTable count: " + ds?.Tables?.Count
                        + "\n\nCached table count: " + dsCache?.Tables?.Count);
                    throw;
                }
                finally
                {
                    sw.Stop();
                    Log.Debug("Execution Time: " + sw.ElapsedMilliseconds.ToString());
                }
            }

     

     

  2. Anil
    Anil avatar
    5 posts
    Member since:
    Sep 2018

    Posted 10 Oct 2018 Link to this post

    We found the cause of the issue. The stored proc for the report was sniffing parameters - WITH RECOMPILE resolved it.
Back to Top