Assembly leak vs dll cache

Stimulsoft Reports.WEB discussion
Post Reply
cmf
Posts: 4
Joined: Tue Jul 28, 2020 1:46 pm

Assembly leak vs dll cache

Post by cmf »

Hi Stimulsoft,
we are using your software to allow users to build their own custom reports.
These report can be single paged or multi paged with the content of the layout being used for each page but with different data.
One of our customers called us with a problem that the application was reaching 40 GB of memory consumption.

After analyzing the dump file we found several thousands of assembly files loaded into memory, we discovered that these assemblies had Stimulsoft code.
We asked the customer and they told us that most of the reports had more than 350 pages and they were doing more than 2000 prints in under 3 hours.

The application runs 24/7 and cannot be restarted to recover the memory.

After debugging we discovered that for each page of the report, a new assembly was created and loaded into memory when the Render method is called (one page = one subreport).
We tried to overcome this problem by using the CreateReportInNewAppDomain method but got serialization exceptions, on the same article that describes the usage of CreateReportInNewAppDomain we also found the cache dll strategy (https://stimulsoft.zendesk.com/hc/en-us ... assemblies), this seemed to be the most logical solution and we tried to use it.

Unfortunately we had some issues, if, for some reason, we load the subreport layout from a byte[] everything works great (except for the assembly leak), but, if we load from the assembly (created after loading the report from the byte[]) the report is empty.

We built a sample application to demonstrate this behavior (attached to this post you can find the source code. password: stimulsoft).

In the sample application if you pass any argument to the .exe you disable the cache and the assembly leak is demonstrated, if you start the application, without any argument, then you see that the only the 1st page of the 1st report has data, all the other pages are empty for the 1st report and for report 2 and 3, we have no data.

If loading the layout from an assembly solves the problem, could you please show us what we are doing wrong?

Hope you can help us to stop this problem from occurring.

Note: for the sample application we are using the latest version of stimulsoft, in the real application we are still using the Stimulsoft.Reports.Web.2018.2.3 version

Best Regards
Attachments
SampleForStimulsoft.zip
(79.85 KiB) Downloaded 106 times
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Assembly leak vs dll cache

Post by Lech Kulikowski »

Hello,

At first, you can use Interpretation mode. In that mode, the compilation is not needed.

Also, were made a lot of fixes and optimizations from 2018.x version, please try to check the last release.

Thank you.
cmf
Posts: 4
Joined: Tue Jul 28, 2020 1:46 pm

Re: Assembly leak vs dll cache

Post by cmf »

Hi Lech,
using the interpretation mode is not a possibility for now at this moment, since we would need to review all the code of the project that is using Stimulsoft and we need to deliver a fix to the customer quickly.

The example that is include in the initial post was done with the latest version of Stimulsoft and the problem is that we are trying to use the "dll cache" solution, the end result is an empty report although no error occurs (we would like to validate this solution to check if the assembly leak no longer occurs since it seems to be the quickest and with the lower risk).
Could you advise on another solution for the problem that is demonstrated in the sample code (a solution to either assembly leak or dll cache mode generating empty report <- as long as this doesn't lead to the assembly leak problem)?

Best Regards,
Luís Pinho
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Assembly leak vs dll cache

Post by Lech Kulikowski »

Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.
#3771
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Assembly leak vs dll cache

Post by Lech Kulikowski »

Hello,

Were made some fixes. Please check the last release build. Also, some recommendations were sent by email.

Thank you.
Post Reply