Error with Images after some time running

Posted by: ryan on 19 September 2017, 9:27 am EST

    • Post Options:
    • Link

    Posted 19 September 2017, 9:27 am EST

    It seems that after calling ExportTiff, our server runs out of memory and causes the error:

    The size of the bitmap is too large that there is not enough memory in system can be allocated to the bitmap.

    This seems to happen after about 2 weeks or running, so it’s not quick but causes massive errors for us when it happens.

    The RAM is only at 60% and there is plenty of disk space. Is there some other space that is being used in this process? We also noticed that once this starts happening some of the section reports are missing images when exporting those to PDF, etc.

    Please help/advise.

  • Posted 19 September 2017, 10:29 pm EST

    Can you please send across your application for me to test it at my end as well? Also, please mention the server OS and the exact version of ActiveReports you’re using.

    Thanks

  • Posted 25 September 2017, 2:04 am EST

    Hello, The issue has happened in production on Azure App Service, and locally has been reproduced on a Windows 10 machine. We have Active Reports 11. It seems to only happen when enough load has occurred (simultaneous report runs). Once it starts happening, nothing but an application pool restart will resolve it.

    Here is the exact bit of code that starts failing (rpt is a Section Report with embedded Image):

    var PngExport1 = new TiffExport();
                        System.IO.MemoryStream msTiff = new System.IO.MemoryStream();
                        if (Params.Page == null)
                        {
                            PngExport1.Export(rpt.Document, msTiff);
                        }
                        else
                        {
                            PngExport1.Export(rpt.Document, msTiff, Params.Page.ToString());
                        }
    

    The images are embedded like this in the .rpx file:

    <Control Type="AR.Image" Name="Picture1" Left="0" Top="60.48" Width="3440.16" Height="959.0399" LineWeight="0" SizeMode="2" PictureAlignment="0">...character_stream_is_it_base64?...</Control>
    
  • Posted 26 September 2017, 6:26 am EST

    Any updates on this? Is there anything we can try or provide further?

  • Posted 26 September 2017, 6:16 pm EST

    Sorry for the delay in getting back to you. I tried replicating your issue at my end with Tiff export, but was unable to. I ran the Tiff export 100 times in a loop and even from different machines at the same time, but didn’t observe the out of memory problem. I have attached the sample application I used for verifying this and also a gif image of the Task Manager. Please take a look.

    Which version of ActiveReports 11 are you using? Could you please try AR11 SP2 if you’re using an older version.AR_Web_TiffExport.zip

    if you’re still facing the problem, please send across your application for me to check.

  • Posted 28 September 2017, 1:48 pm EST

    So we experienced it again… This seems to happen when a user created a report that builds a PDF of 3,000 pages - which took 20 minutes a run, and they ran it 4 times (tired of waiting) on a 4 core machine. This made the CPU peg at 100%. After the 20 minutes or so was up, it resolved the CPU load, but the entire server was in a state that could only be solved by restarting the application pool again.

    is there a way to make AR limit itself to a single core, or prevent this from occurring?

  • Posted 2 October 2017, 8:42 am EST

    Another question - maybe we can add code to limit the run if the page count is over some number? We saw this again today with reports of 2,000 pages. If possible, can we add code to the top of all layouts which would stop processing if the layout will exceed something like 500 pages? We want to limit this based on the RPX, PDF layout, not the SQL - the SQL data load runs fine.

  • Posted 26 November 2020, 9:28 pm EST

    I have the same problem with version 14.1.20320

    The problem is the parallel.Foreach → I must limited the MaxDegreeOfParallelism to 3, because it’s higher then 3 then it throws exception in marked code line!

    
    public static void ArchiveTiffFiles(IList<PrintDocuments> allReports, string tiffFilePath) // in allReports are 200 Reports --> one generated TiffFile is 33.1 MB in size
    {
    	var resultReportlst = allReports.Where(re => re.IndexValue != null).GroupBy(report => report.OrderCounter).OrderBy(rp => rp.Key);
    	
    	Parallel.ForEach(resultReportlst, new ParallelOptions { MaxDegreeOfParallelism = 4 },  report =>
    	{
    		foreach (var exportDocumentPage in report.Document.Document.Pages)
            {
    			var tmpSectiondocument = new SectionDocument();
                tmpSectiondocument.Pages.Add(exportDocumentPage);
                if (report.Document.Document.Pages.Count > 1)
                {
    				fileCount = documentPageCounter++;
                }
                else
                {
    				fileCount += documentPageCounter++;
                }
                string tifffilenumber = fileCount.ToString("D3");
    			
    			GrapeCity.ActiveReports.Export.Image.Tiff.Section.TiffExport tiffSetting = new GrapeCity.ActiveReports.Export.Image.Tiff.Section.TiffExport();
    			tiffSetting.CompressionScheme = CompressionScheme.None;
    			tiffSetting.Dither = true;
    			tiffSetting.DpiX = 300;
    			tiffSetting.DpiY = 300;
    			tiffSetting.Pagination = true;
            
    			tiffSetting.Export(tmpSectiondocument, Path.Combine(tiffFilePath, tifffilenumber) + ".tif"); // Here throws the exception with the message: The size of the bitmap is too large that there is not enough memory in system can be used to draw the report on the bitmap.
    			tiffSetting.Dispose();	
    		}
    		
    	});
    
    }
    
    
  • Posted 2 December 2020, 1:17 am EST

    Hello,

    I have replied to the following thread:

    https://www.grapecity.com/forums/ar-dev/export-image-tiff-does-not

    Please reply to above thread only to avoid confusion.

    Thanks,

    Mohit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels