Crystal Reports Exception: The maximum report processing jobs limit configured by your system administrator has been reached

StackOverflow https://stackoverflow.com//questions/9579914

Question

I'm facing a very buggy issue, in ASP.NET application after viewing the same report many times simultaneously I got this exception:

The maximum report processing jobs limit configured by your system administrator has been reached.

Wait I know there are tons of solutions out there but all of them are not working with me.

  1. I put ReportDocument.Close(); ReportDocument.Dispose(); in CrystalReportViewer_Unload event, and still throw the exception.

    Private Sub CrystalReportViewer1_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Unload reportFile.Close() reportFile.Dispose() GC.Collect() End Sub

  2. I edit the PrintJobLimit registry in HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\InprocServer and HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\Server to -1 even to 9999, and still throw the exception.

Here is the code snippet where I call my report:

 Table_Infos = New TableLogOnInfos()
                Table_Info = New TableLogOnInfo()
                Con_Info = New ConnectionInfo()

                With Con_Info
                    .ServerName = ConfigurationManager.AppSettings("server_name")
                    .DatabaseName = ConfigurationManager.AppSettings("DB")
                    .UserID = user_name
                    .Password = pass_word
                    .Type = ConnectionInfoType.SQL
                    .IntegratedSecurity = False
                End With

                Table_Info.ConnectionInfo = Con_Info

                If Session("recpt_lang") = "Arabic" Then
                    reportFile.Load(Server.MapPath("/Reports/") & "collectrecpt_new_ar.rpt")
                ElseIf Session("recpt_lang") = "English" Then
                    reportFile.Load(Server.MapPath("/Reports/") & "collectrecpt_new.rpt")
                End If

                For Each mytable In reportFile.Database.Tables

                    mytable.ApplyLogOnInfo(Table_Info)

                Next

                CrystalReportViewer1.ReportSource = reportFile
                CrystalReportViewer1.SelectionFormula = Session("SelectionForumla")
                CrystalReportViewer1 = Nothing
Was it helpful?

Solution

I would recommend moving your close/dispose/gc.collect code outside of that unload process. In other words:

  1. Load report
  2. Assign to Viewer Control
  3. Show Report in Viewer Control
  4. Close Viewer Control and Unload (completely)
  5. Then close/dispose/gc.collect outside of any viewer control code

My guess is the viewer control is not completely closed when the report is being cleaned up.

Crystal is a very memory intensive process and very finicky.

OTHER TIPS

You have to Dispose your report instance after all. If you Dispose the report after showing it, you will never see the error "The maximum report processing jobs limit configured by your system administrator has been reached" again.

  Dim report1 As rptBill = clsBill.GetReport(billNumber)

  rpt.Print()

  'Cleanup the report after that!
  rpt.Close()
  rpt.Dispose()

Crystal Report document implements IDisposable interface. So all you have to do is to enclose the report's instance with using statement. It will be automatically closed and disposed once the using statement is completed. You can write something like that:

using(var report = GetInvoiceReport())
{
     // your logic here
}

or (depends on your context):

using(var report = new ReportDocument())
{
     // your logic here
}

Greetings I am too late to have answer on it, all reply are working and i have seen but in case still you are facing same problem and error then please once go in to TEMP folder under "windows" directory and delete all instances of crystal report. I am saying this because all above option will work but you are still in the maximum reach so first of all delete all instance then apply all the above suggestion. thanks

I was working on local report server. I have hosted my web application in other pc. When I got such error I just did IISRESET and working fine now.

Try this, this could help you.

Make sure you are using PUSH model to display your reports. Next you have to make one change in your Server's registry: Follow the path:

"HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\InprocServer" 

and you will see an item " PrintJobLimit" and you will see that its default value is 75. that means the server can only handle 75 reports at a time. Dont worry about that and just modify the value to -1

You have to Dispose your report instance after all. If you Dispose the report after showing it, you will never see the error:

The maximum report processing jobs limit configured by your system administrator has been reached

Code:

Dim report1 As rptBill = clsBill.GetReport(billNumber)

rpt.Print()

'Cleanup the report after that!
rpt.Close()
rpt.Dispose()

Make sure IIS user have sufficient permission to delete files present in "c:/windows/temp" folder.

I face the same issue once I provide write permission to that folder then it solved my issue.Also make sure dispose that object after generating the file

In my case, the report had 4 subreports...

What solved for me was changing the value of "PrintJobLimit", from 75 to 500, in the following Regedit paths:

  • \HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\InprocServer

  • \HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\Server

I know this thread is older, but if you configure the app pool setting "Recycling..." to recycle at, say, 180 minutes instead of 1740 minutes (the default), this might free up the needed resources.

I ended up using GC.WaitForPendingFinalizers in addition to the GC.Collect, close and dispose. I believe my web page was perhaps unloading and stopping thread processing prematurely before the garbage was properly processed (really?)

This is on Server 2012, SQL 2012, CR 13.0.2000.0

Here's my code:

#Region "Cleanup"

Private Sub crCleanup(Optional blnForce As Boolean = False)
    Try
        ' Crystal(code Is Not managed, i.e.it) 's COM interop => you have to manually
        ' release any objects instantiated. Make sure you set the ref to nothing and
        ' also call the dispose method if it has one.

        ' under some conditions, we don't want to destroy the ReportDocument (e.g. report page-to-page navigation)
        If blnForce OrElse Me.blnPageHasFatalError OrElse (Not Me.CrystalUseCache) Then ' do not release when using cache! (unless forced)
            If Not crReportDocument Is Nothing Then Me.crReportDocument.Close()
            If Not crReportDocument Is Nothing Then Me.crReportDocument.Dispose()
            If Not thisWebAppUser Is Nothing Then Me.thisWebAppUser.Dispose()
            Me.thisWebAppUser.ClearReportCache() ' we are using HttpContext.Current.Cache.Item instead of sessions to save CR document
        End If

        ' the rest of the items, we'll always want to clean up
        If Not crParameterFieldDefinitions Is Nothing Then crParameterFieldDefinitions.Dispose()
        If Not crParameterFieldDefinition Is Nothing Then crParameterFieldDefinition.Dispose()

        crParameterFields = Nothing
        crParameterField = Nothing
        crParameterFieldName = Nothing
        crParameterValues = Nothing
        crParameterDiscreteValue = Nothing
        crParameterDefaultValue = Nothing
        crParameterRangeValue = Nothing

        '
        If Not crSections Is Nothing Then crSections.Dispose()
        If Not crSection Is Nothing Then crSection.Dispose()
        If Not crReportObjects Is Nothing Then crReportObjects.Dispose()
        If Not crReportObject Is Nothing Then crReportObject.Dispose()
        If Not crSubreportObject Is Nothing Then crSubreportObject.Dispose()
        If Not crDatabase Is Nothing Then crDatabase.Dispose()
        If Not crTables Is Nothing Then crTables.Dispose()
        If Not crTable Is Nothing Then crTable.Dispose()
        crLogOnInfo = Nothing
        crConnInfo = Nothing

        crDiskFileDestinationOptions = Nothing
        ConnParam = Nothing

        If Not subRepDoc Is Nothing Then subRepDoc.Dispose()
    Catch ex As Exception
        Me.thisWebAppUser.SendSysAdminMessage("Failed CR cleanup", ex.ToString)
    End Try


    ' yes, use of the GC.Collect (and even more the GC.WaitForPendingFinalizers) is highly controversial
    ' 
    ' the reality is that rendering crystal reports is rather slow compared to most web operations
    ' so it is expected that waiting for GC will have relatively little performance impact
    ' and will in fact, help tremendously with memory management.
    '
    ' try setting these values to 1 and confirm for yourself by instantiating multiple crDocuments in different browsers if you don't believe it:
    '
    '   HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\InprocServer 
    '   HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\Server 
    '
    ' or google this error: The maximum report processing jobs limit configured by your system administrator has been reached
    ' 
    ' I believe the problem is that on very fast servers, the page unloads and stops processing code to properly cleanup the Crystal Report objects
    ' 
    ' This is done in 3 places: 
    '   Report Viewer (Page_Unload and CrystalReportViewer1_Unload) rendering a report will of course always using a processing job
    '   Report Parameter Selector (Page_Unload) loading a crDocument without rendering a report still counts towards CR processing job limit.
    '   Custom Control crReportParameterSelectionTable (Public Overrides Sub dispose())

    GC.Collect()
    GC.WaitForPendingFinalizers()

End Sub
'***********************************************************************************************************************************
' 
'***********************************************************************************************************************************
Private Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Unload
    'If Me.IsCallback Then Exit Sub ' the menutree causes callbacks, but we are not interested

    crCleanup()
    ' response object not available here, so cannot redirect (such as in the case of XLS opeing in a separate window)

    ' if for some crazy reason there is STILL a crReportDocument, set it to nothing
    '        If Not crReportDocument Is Nothing Then Me.crReportDocument = Nothing
    '        Me.CrystalReportViewer1 = Nothing
End Sub

Private Sub CrystalReportViewer1_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Unload
    'If Me.IsCallback Then Exit Sub ' the menutree causes callbacks, but we are not interested

    crCleanup()
End Sub

End Region

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top