This is a migrated thread and some comments may be shown as answers.

Report viewer sometimes fails to render reports

6 Answers 1868 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 24 Jan 2017, 01:35 PM
Hi,

I`m using Html Report viewer (R2 2016) integrated in a web application.
I`m experiencing the following problem:

When the application is published (to test or production environment) sometimes the report viewer seems to fail rendering the reports (this does not happen on my Dev environment).
It does not happen all the time, it just happens sometimes.
When the problem occurs the viewer seems to send never ending requests to the Report API controller with the following signature:
~/api/reports/clients/085352-e708/instances/083615-c3d7/documents/085412-2b2a085412-5cbd/info which result with the following json response:
{
"documentReady":false,
"pageCount":0,
"documentMapAvailable":false,
"bookmarkNodes":null
}
No errors, no timeouts just this same json returned saying "documentReady":false.
Once this happens the only way to stop these requests is:
-Restart iis
-Refresh browser
-Delete report viewer cache directory.

If for example I click back button and open the report again, it may be rendered but the requests from the old report continue running.
I`m not sure if the caching behavior has something to do with this but we are using File storage cache with changed default cache directory from "C:\Windows\temp" to internal directory for the Reports web application that is hosted in IIS.
This is the ReportServiceConfiguration object:

new Telerik.Reporting.Services.ReportServiceConfiguration
{
HostAppId = ...,
ReportResolver = ...,
Storage = new FileStorage(HttpContext.Current.Server.MapPath("~/Reports")),
ReportSharingTimeout = 0,
ClientSessionTimeout = 15,
};

I`m attaching a screenshot demonstrating the requests from Google Chrome.

I spent some time investigating the problem with enabled system diagnostics trace listener for the Reporting API.
I observed the following in the log:
If the report is rendered successfully, then the log is just filled with some performance metrics information:
*** ReportProcessor.ProcessReport STARTED ***
*** ProcessReport #0 STARTED ***
*** ReportProcessor.ProcessReport STARTED ***
*** ProcessReport #0 STARTED ***
*** ProcessReport #0 DONE in 00:00:00.5807344 ***
*** ReportProcessor.ProcessReport DONE in 00:00:00.5903065 ***
...

If some error occurs for some reason (bad query, data conversion error, data source discovery/connection problems) it is indicated in the log and the report is rendered showing the error to the user, which is ok:
...
An exception has occurred while processing 'table1' item:
System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting date and/or time from character string.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   ...

There are though other errors that occur (for unknown reasons) that don`t seem to stop report from being executed, resulting in endless requests that were previously described.
I managed to catch two of these errors without any explanation why and when they happen (the same report with the same input parameters sometimes fails and sometimes not):

1.
...
An error has occurred while rendering the report: System.Threading.ThreadAbortException: Thread was being aborted.
   at Microsoft.Win32.Win32Native.CreateDirectory(String path, SECURITY_ATTRIBUTES lpSecurityAttributes)
   at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
   at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
   at Telerik.Reporting.Cache.File.FileCache.Write(String key, Byte[] bytes)
   at Telerik.Reporting.Cache.CacheStorage.SetBytes(String key, Byte[] value)
   at Telerik.Reporting.Services.Engine.DocumentResources.AddResource(RenderingResource resource)
   at Telerik.Reporting.Services.Engine.Document.AddResource(RenderingResource s)
   at Telerik.Reporting.Services.Engine.RenderingStream.Finish()
   at Telerik.Reporting.Html5Rendering.Writers.ContentOnlyPage.WritePageStyles(String css)
   at Telerik.Reporting.Html5Rendering.Writers.PageBase.WriteEndPage()
   at Telerik.Reporting.Paging.PageCompositionBase.SendPhysicalPages()
   at Telerik.Reporting.Paging.PageCompositionBase.OutputPage()
   at Telerik.Reporting.Paging.PageCompositionBase.CreatePages()
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback)
*** RenderReport #0 DONE in 00:00:00.3681450 ***

2.
...
*** RenderReport #0 STARTED ***
An error has occurred while rendering the report: System.Threading.ThreadAbortException: Thread was being aborted.
   at System.Delegate.DelegateConstruct(Object target, IntPtr slot)
   at Telerik.Reporting.Processing.ElementTreeHelper.GetFirstDescendantsOfType[T](LayoutElement element)
   at Telerik.Reporting.Paging.PagerBase.ResetBookmarkPages(ProcessingElement element)
   at Telerik.Reporting.Paging.PagerBase.ResetBookmarkPages(ProcessingElement element)
   at Telerik.Reporting.Paging.PagerBase.Telerik.Reporting.Paging.IPager.CreatePages(IPageHandler handler, Report report)
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback)
*** RenderReport #0 DONE in 00:00:00.7007492 ***

An error has occurred while rendering the report: System.Threading.ThreadAbortException: Thread was being aborted.
   at Telerik.Reporting.Html5Rendering.CssStyleBuilder.AddBackgroundDeclarations(LayoutElement element)
   at Telerik.Reporting.Html5Rendering.CssStyleBuilder.AddCssStyleFromProcessingElement(LayoutElement element, ElementPageInfo pageInfo)
   at Telerik.Reporting.Html5Rendering.Writers.Html.Element.Begin(LayoutElement element, ElementPageInfo pageInfo)
   at Telerik.Reporting.Html5Rendering.Writers.Report.WriteStartElement(LayoutElement element, ElementPageInfo pageInfo)
   at Telerik.Reporting.Paging.PageElementLayer.AddToPage(IPageHandler handler)
   at Telerik.Reporting.Paging.PageElementManager.AddToPage(IPageHandler handler)
   at Telerik.Reporting.Paging.PageCompositionBase.SendPhysicalPages()
   at Telerik.Reporting.Paging.PageCompositionBase.OutputPage()
   at Telerik.Reporting.Paging.PageCompositionBase.CreatePages()
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback)
*** RenderReport #0 DONE in 00:00:00.7177329 ***



Is there any explanation of this behavior, how can I troubleshoot the reason behind it?

6 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 25 Jan 2017, 10:14 AM
Hello Daniel,

The INFO request is sent by the viewer to check the status of the report that is processed and rendered on the server - check Cache Management. It can go to infinity or until the server returns an error in response.

The error from your screenshot indicates that the client id (the registered id of the viewer) cannot be found in the cache storage. Possible reasons:
  1. The Cache storage is not accessible.
    Set an unique HostAppId for the Reporting REST service (Reportscontroller.cs).
    Reconfigure the Storage property to use the second overload of FileStorage and specify a cache storage folder accessible by the application, preferably not the Reports folder, but a dedicated for cache one. In a web farm or with load balancing, you will need an MsSqlServerStorage.
    Assure the IIS process (Application pool's identity) has read/write access to the configured cache storage.


About "An exception has occurred while processing 'table1' item:
System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting date and/or time from character string.
", check the report settings in a Report Designer. There must be a DateTime parameter or field. Verify you are passing a valid Datetime object, not a string as strings will be converted based on the server machine's culture to Datetime (possible source of conversion problems). Avoid passing an empty string as a value to report parameters - you can set default values to report parameters on designing the report.
Just in case it is a message formatting problem, update JSON.NET Nuget package to the latest available via VS Nuget Package Manager.

About "An error has occurred while rendering the report: System.Threading.ThreadAbortException: Thread was being aborted.
   at Microsoft.Win32.Win32Native.CreateDirectory(String path, SECURITY_ATTRIBUTES lpSecurityAttributes)
", this is related to read/write access to the cache storage. The previously suggested settings of the Reporting REST Service Storage should affect this error.


The rest errors are related to the processing and rendering of reports. The errors point to bookmark and style settings. If you are modifying reports in code, please check - Changes on items in report events are not applied.
We will have to review the reports definitions to investigate further these problems.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Daniel
Top achievements
Rank 1
answered on 25 Jan 2017, 06:41 PM

Hi,

 

Thanks for the answer. Actually it helped me because when I replaced the cache folder to the default state (windows temp) this problem disappeared. Most probably I will investigate the alternative caching mechanisms, but still it is not clear why the File storage only seem to work with the default folder. I tried several different folders ensuring the access rights are granted to the process, but only the default works without the problem.

0
Stef
Telerik team
answered on 26 Jan 2017, 09:58 AM
Hello Daniel,

Test changing the used application pool's Identity in IIS Manager and restart the application. Then check if the folder specified by the FileStorage has given read/write access to the IIS user. Test giving full permissions to everyone on the folder. Also set an unique HostAppId in the Reporting REST service's configuration, in case there are other Reporting REST services attempting to access the same cache folder.

By default the FileStorage usee C:\Temp folder, check its permissions settings and compare theme to the custom folder. Test to use a custom cache folder out of the solution's structure e.g. C:\MyFolder.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Rosan
Top achievements
Rank 1
answered on 29 Aug 2018, 09:38 AM

Im experiencing the following error after moving from 2016 to 2018 R2. Any suggestion to fix this issue.

 

Total cache clean time: 00:00:00.3226973
Rendering thread 71 starts work.
Rendering operation finished abnormally: Telerik.Reporting.Services.Engine.InvalidRenderingArgsException: Pending rendering args with ID '954efb10ead' not found.
   at Telerik.Reporting.Services.Engine.PersistableCollection`1.get_Item(String itemID)
   at Telerik.Reporting.Services.Engine.ReportEngine.RenderReportDocument(String pendingRenderingId)
Rendering thread 71 finishes work.

0
Todor
Telerik team
answered on 30 Aug 2018, 02:07 PM
Hi Rosan,

There are changes introduced with Telerik Reporting versions released in 2018.
The problem may be related to one of them.

Starting with Telerik Reporting R1 2018 SP3 (12.0.18.416) System.Web.HttpContext.Current is not available in the report rendering thread. This may be a problem when using Custom Report Resolver. Check the How to use information from HttpContext in Custom Report Resolver KB article for details.

Another change that may influence the upgraded projects is the referred version of NewtonSoft.Json - check the Error after upgrading to R2 2018 - The 'ObjectContent`1' type failed to serialize... KB.

Regards,
Todor
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Sainand
Top achievements
Rank 1
answered on 25 Sep 2018, 04:27 PM

HI Daniel,

 

What is procedure to change the cache folder to default.

Tags
General Discussions
Asked by
Daniel
Top achievements
Rank 1
Answers by
Stef
Telerik team
Daniel
Top achievements
Rank 1
Rosan
Top achievements
Rank 1
Todor
Telerik team
Sainand
Top achievements
Rank 1
Share this question
or