.Net Framework or Crystal Reports is leaking handles and possibly memory

 This is an application created for testing the handles leaks and memory as proof of concept, so either CR(Crystal Reports) or MS(Microsoft) fix the problem in their future service packs.

            When you click on the button to create reports, and after it finishes, there are handles leaking, and memory leaking as seen in the picture in the link.

 Source+picture:

            https://skydrive.live.com/redir.aspx?cid=cd5cefef4ca716e1&resid=CD5CEFEF4CA716E1!184&parid=root

             this has been reported to MS, and the link is: please vote for its fix

https://connect.microsoft.com/VisualStudio/feedback/details/724001/net-framework-is-leaking-handles-and-possibly-memory

             and to SAP RS, and the link is:

                        http://forums.sdn.sap.com/post!reply.jspa?messageID=11053710

          

work around:

create 1 ReportDocument instance and use it a specific number of time, say 50 times, and dispose of it, then recreate another instance and repeat.

this will make the handle leak or memory leak get divided by the instance number of usage.

at least now our hundreds of thousands of reports app is working perfectly without hanging or creating exceptions.

 and to why not to use one instance of ReportDocument for all the reports, it happened some times that the app hangs without any exceptions.

 third, i noticed when the app is working and the anti-virus(Kaspersky) begin a full scan of the computer and eating all CPU resources, it hangs, and when the anti-virus finishes it work, the app does not continue at all and does not produce exceptions.

 OS: Win XP + Win 7 + win 2003 server

.Net: v2

CR: v13 sp2

VS: 2010 sp1

 

 Earlier article details:

Crystal Reports v13 sp2 leaks handles

I have a problem with Crystal Reports, it seams that it leaks handles.

I am making a utility that generates hundreds of thousands of “.pdf” reports that are exported from crystal Report, but after a awhile an error is generated saying :

CrystalDecisions.Shared.CrystalReportsException: Load report failed. —> System.Runtime.InteropServices.COMException (0x80000000): The maximum report processing jobs limit configured by your system administrator has been reached

And the full detail of the error is in the end of this thread.

download:Bin and source: click Here

OS: tested on win 7 32bit, win xp 32bit.

Procedure:

Run the “testCR.exe”

Click button “Open CR Form”

On the new form. Click “Create Reports”

If you select to create 1 report at a time, and open task manager and watch the testCR handles, you will see it increasing and then going back to normal but leave 1 or 2 handles not recovered.

Error Details:

CrystalDecisions.Shared.CrystalReportsException: Load report failed. —> System.Runtime.InteropServices.COMException (0x80000000): The maximum report processing jobs limit configured by your system administrator has been reached.

at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)

at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)

at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()

— End of inner exception stack trace —

at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()

at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)

at CrystalDecisions.CrystalReports.Engine.ReportClass.Load(String reportName, OpenReportMethod openMethod, Int16 parentJob)

at CrystalDecisions.CrystalReports.Engine.ReportDocument.EnsureLoadReport()

at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)

at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataSet dataSet)

at CRP0100.CCrystalReport.SetDataSource() in D:\Work\vDoxTest\CRP0100\CCrystalReport.vb:line 149

at VDXL0100.frmExportReports.createReports() in D:\Work\vDoxTest\VDXL0100\frmExportReports.vb:line 72

at VDXL0100.frmExportReports.btnCreateReports_Click(Object sender, EventArgs e) in D:\Work\vDoxTest\VDXL0100\frmExportReports.vb:line 31

About Reader Man حسين ناجي الصفافير

حسين ناجي الصفافير Hussain Naji Al-Safafeer Info: https://readerman1.wordpress.com/aboutme
This entry was posted in Technical and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s