Declined
Last Updated: 05 Sep 2022 14:35 by StillLearnin
StillLearnin
Created on: 21 Jun 2022 21:35
Type: Bug Report
3
HTML5 report viewer cancel button does not cancel report generation on the server

Clicking the cancel button on the HTML5 report viewer show "Report processing was canceled" in the UI but the report is still being generated and rendered on the server.

In this old thread it is stated that it isn't possible to cancel the report generation on the server. Is that still the case?

5 comments
StillLearnin
Posted on: 05 Sep 2022 14:35

I see that this bug report never got updated with the final resolution. In the support ticket that I opened to resolve my issue, the support team member suggested the following test.

  1. Attach a trace listener to the project with the Reporting REST Service and the HTML5 Report Viewer
  2. Render the report once without canceling it
  3. Reload the page and this time cancel the report rendering immediately

We log information about how much the processing and the rendering of the report take and it should be available in the generated log(s). The time when the report was canceled should be lower than when rendering it full and it should prove that the canceling is taking effect. 

For guidance on how to use the Trace Listener, please see the Troubleshooting reporting implementation into ASP.NET Core application KB article.

 

After following these instructions, I discovered that we were incorrectly dispatching the report from the HTML report viewer and that no less than FOUR instances of each report were being run each time we dispatched a report. The cancel button would cancel the last instance of the report but the first three would continue until they finished or server resources were exhausted. Once we fixed our React rendering issue so that the reports were only dispatched once, the cancel button functioned as we expected.

Evgenii
Posted on: 05 Sep 2022 14:25
I confirm the same problem, cancelation doesn't work as expected - I see the server resources consumption after cancelling. It is painful for big report request.

I'm attaching VS memory and cpu concumptions. First one - regular consumption when rendering report. The second - consumption after pressing cancel button.
In the "cancel button" case after the whole process completed I got an exception

The thread 0x7340 has exited with code 0 (0x0).
An error has occurred while rendering the report: System.OperationCanceledException: Canceled rendering of document 7b1ce94b185a3ff3eaa934.
   at Telerik.Reporting.Services.Engine.ReportEngine.DocumentCancellationController.ThrowIfCancellationRequested() in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Services.Engine\ReportEngine.DocumentCancellationController.cs:line 34
   at Telerik.Reporting.Paging.PageCompositionBase.<>c__DisplayClass87_0.<CreatePages>b__0() in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Paging\PageCompositionBase.cs:line 395
   at Telerik.Reporting.Paging.PageCompositionBase.CreatePages() in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Paging\PageCompositionBase.cs:line 430
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(LayoutElement root, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback, PageSettings pageSettings) in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\BaseRendering\RenderingExtensionBase.cs:line 115
An error has occurred while rendering the report: System.OperationCanceledException: Canceled rendering of document 7b1ce94b185a3ff3eaa934.
   at Telerik.Reporting.Services.Engine.ReportEngine.DocumentCancellationController.ThrowIfCancellationRequested() in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Services.Engine\ReportEngine.DocumentCancellationController.cs:line 34
   at Telerik.Reporting.Paging.PageCompositionBase.<>c__DisplayClass87_0.<CreatePages>b__0() in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Paging\PageCompositionBase.cs:line 395
   at Telerik.Reporting.Paging.PageCompositionBase.CreatePages() in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Paging\PageCompositionBase.cs:line 430
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(LayoutElement root, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback, PageSettings pageSettings) in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\BaseRendering\RenderingExtensionBase.cs:line 115
MyService.exe Error: 0 : An error occurred while rendering the report in separate thread: System.OperationCanceledException: Canceled rendering of document 7b1ce94b185a3ff3eaa934.
   at Telerik.Reporting.Services.Engine.ReportEngine.DocumentCancellationController.ThrowIfCancellationRequested() in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Services.Engine\ReportEngine.DocumentCancellationController.cs:line 34
   at Telerik.Reporting.Paging.PageCompositionBase.<>c__DisplayClass87_0.<CreatePages>b__0() in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Paging\PageCompositionBase.cs:line 395
   at Telerik.Reporting.Paging.PageCompositionBase.CreatePages() in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Paging\PageCompositionBase.cs:line 430
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(LayoutElement root, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback, PageSettings pageSettings) in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\BaseRendering\RenderingExtensionBase.cs:line 121
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback) in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\BaseRendering\RenderingExtensionBase.cs:line 55
   at Telerik.Reporting.Processing.ReportProcessor.CountPages(IList`1 reports, IRenderingContext renderingContext, Hashtable deviceInfo, ExtensionInfo extensionInfo) in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Processing.ReportProcessor\ReportProcessor.CountPages.cs:line 55
   at Telerik.Reporting.Processing.ReportProcessor.RenderCore(ExtensionInfo extensionInfo, IList`1 processingReports, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback) in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Processing.ReportProcessor\ReportProcessor.RenderReport.cs:line 309
   at Telerik.Reporting.Services.Engine.ReportRenderer.Render(ReportRendererArgs args) in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Services.Engine\ReportRenderer.cs:line 51
   at Telerik.Reporting.Services.Engine.Rendering.RenderWithCulture(ReportRendererArgs args) in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Services.Engine\Rendering.cs:line 190
   at Telerik.Reporting.Services.Engine.Rendering.ThreadFunc(Object o) in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Services.Engine\Rendering.cs:line 158
MyService.exe Error: 0 : An error occurred while rendering the report in separate thread: System.OperationCanceledException: Canceled rendering of document 7b1ce94b185a3ff3eaa934.
   at Telerik.Reporting.Services.Engine.ReportEngine.DocumentCancellationController.ThrowIfCancellationRequested() in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Services.Engine\ReportEngine.DocumentCancellationController.cs:line 34
   at Telerik.Reporting.Paging.PageCompositionBase.<>c__DisplayClass87_0.<CreatePages>b__0() in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Paging\PageCompositionBase.cs:line 395
   at Telerik.Reporting.Paging.PageCompositionBase.CreatePages() in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Paging\PageCompositionBase.cs:line 430
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(LayoutElement root, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback, PageSettings pageSettings) in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\BaseRendering\RenderingExtensionBase.cs:line 121
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback) in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\BaseRendering\RenderingExtensionBase.cs:line 55
   at Telerik.Reporting.Processing.ReportProcessor.CountPages(IList`1 reports, IRenderingContext renderingContext, Hashtable deviceInfo, ExtensionInfo extensionInfo) in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Processing.ReportProcessor\ReportProcessor.CountPages.cs:line 55
   at Telerik.Reporting.Processing.ReportProcessor.RenderCore(ExtensionInfo extensionInfo, IList`1 processingReports, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback) in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Processing.ReportProcessor\ReportProcessor.RenderReport.cs:line 309
   at Telerik.Reporting.Services.Engine.ReportRenderer.Render(ReportRendererArgs args) in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Services.Engine\ReportRenderer.cs:line 51
   at Telerik.Reporting.Services.Engine.Rendering.RenderWithCulture(ReportRendererArgs args) in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Services.Engine\Rendering.cs:line 190
   at Telerik.Reporting.Services.Engine.Rendering.ThreadFunc(Object o) in C:\DT_Rep_A1\_work\8\s\Source\Code\Telerik.Reporting\Services.Engine\Rendering.cs:line 158

Seems like it throw cancel exception too late, after the whole process completed
Attached Files:
ADMIN
Dimitar
Posted on: 04 Jul 2022 12:11

Hello,

Our apologies if the question was misunderstood.

The CancellationToken is being sent automatically by the report viewer when the 'Cancel' button on the report viewer toolbar is clicked, no additional C# code is required for this functionality to work.

The case is currently being discussed in a separate support ticket. If a problem with the HTML5 Report Viewer cancellation of the report rendering is discovered, this item will be updated to reflect it.

Regards,
Dimitar
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
StillLearnin
Posted on: 28 Jun 2022 13:41

My apologies for not making myself clear enough.

Clicking the cancel button causes the UI to display "Report processing was canceled" and the report never displays in the viewer. This is expected and correct behavior.

However, if you watch the report servers' resource consumption (RAM, CPU, etc.) it is obvious that the server is still rendering the report as the resource consumption continues to grow until the report has finished rendering.

I know how to use task cancellation tokens in other C# coding that I do but I couldn't find documentation on how to use the Cancellation Token when using your HTML5 report viewer and Reporting REST service. Could you point me to the documentation please?

ADMIN
Todor
Posted on: 28 Jun 2022 10:34

Hi Melvin,

I confirm that you may cancel the report rendering by passing Cancellation Token to the RenerReport and PrintReport methods of the ReportProcessor. We introduced this feature with R2 2020 (14.1.20.513) - Allow the ReportProcessor to cancel the current report rendering. The cancellation is available also to the viewers with our latest versions.

Please, note that the cancellation doesn't happen immediately. If report generation is fast enough, the report may be already rendered before the cancellation token is passed to the ReportProcessor as the request for cancellation is sent through the Reporting REST Service.

I tested with our ReportBook online demo and managed to cancel the rendering. The first report was already rendered, but the rendering of the rest of the reports in the book was effective. I tried also with our examples and managed to cancel the report rendering in debug mode.

For the above reasons, I have marked this bug report as declined.

Regards,
Todor
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.