cancel
Showing results for 
Search instead for 
Did you mean: 

W3WP.exe crash with Access Violation on RptDoc.Close

charles_gagnon
Participant
0 Kudos

Hello,

We have a web application that also lets the users run many different reports. We are using Crystal Report for Vs2010 Sp1 setup on a Windows 2008 R2. The IIS web site is configured to run in 64-bit mode.

To dispose the report we have a Timer on the server that validates if the report is still opened on the client. To know if the report is still open we have a CallBack function on our Report Viewer page that pings the server. When the page stops pinging the server we know that the report can be closed and disposed.

Here is the code for report closing and disposing:


      Try
         If Not Me.RptDoc() Is Nothing Then
            Me.RptDoc.Close()
            Me.RptDoc.Dispose()
            Me.RptDoc = Nothing
         End If
      Catch ex As System.Threading.ThreadAbortException
         Throw ex
      Catch ex As System.Exception
         'To Avoid thread crash on error
      Finally
      End Try

From time to time when doing RptDoc.Close an access Violation happens that kills the W3WP.exe process. Even if we have a Try...Catch statement it does not seem to be able to catch the error and avoid the W3WP.exe from crashing.

Is there a way to avoid this issue?

Thank you.

Charles

Accepted Solutions (1)

Accepted Solutions (1)

charles_gagnon
Participant
0 Kudos

Hello,

Here is the DebugDiag 1.2 trace:

.NET Call Stack

Function

CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Close()

DomainNeutralILStubClass.IL_STUB_CLRtoCOM()

CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.InternalClose(Boolean, Boolean)

CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Dispose(Boolean)

System.ComponentModel.Component.Dispose()

CrystalDecisions.CrystalReports.Engine.ReportDocument.ClearCache(Boolean)

CrystalDecisions.CrystalReports.Engine.ReportDocument.InternalClose(Boolean)

CrystalDecisions.CrystalReports.Engine.ReportDocument.Close()

ICE.Utility.IceReportClass.Dispose()

ICE.Utility.IceSessionState.CheckSessionExpires(Int64, Boolean)

ICE.Utility.IceApplication.CheckSessionExpires(System.Object)

System.Threading.ExecutionContext.runTryCode(System.Object)

System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)

System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)

System.Threading._TimerCallback.PerformTimerCallback(System.Object)

charles_gagnon
Participant
0 Kudos

And the FullStack Trace if you need more information please let me know.

Full Call Stack

Function Arg 1 Arg 2 Arg 3 Arg 4 Source

mfc80u!ATL::CSimpleStringT<wchar_t,1>::operator=+2e 00000000`0eba6c50 00000000`000003e6 80000000`00000000 00000000`0c19ba5d

mfc80u!ATL::CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > >::operator=+e 00000000`000003e6 00000000`0eba6c78 80000000`00000000 00000000`74796dfb

cslibu_3_0!CSLib300::CSString::operator=+f 00000000`638bad70 00000000`00000000 00000000`000003e6 00000000`00000001

crpe32!MWCleanupProcess+80f99 00000000`638bad70 00000000`638bad70 00000000`63864390 00000000`000003e6

crpe32!MWCleanupProcess+81272 00000000`638bad70 00000000`0eba7678 80000000`00000000 00000000`63864390

crpe32!MWCleanupProcess+4e4e3 00000000`638bad70 00000000`00000000 00000000`00000000 00000000`00000116

crpe32!PECloseSubreport+1ac 00000000`00000116 00000000`638bad70 00000000`00000000 00000000`634fca40

dtsagent!DllRegisterServer+5050e 00000000`63864320 00000000`0eba7a68 00000000`0ebad790 00000000`0ebad790

dtsagent!DllRegisterServer+a1f71 00000000`00000000 00000000`00000001 00000000`0ebad790 00000000`63864320

dtsagent!DllRegisterServer+ab954 00000000`637a9f40 00000000`00000000 00000000`00000000 00000000`00000000

dtsagent+f5e3 ffffffff`00000000 00000000`637aa070 00000000`009a4618 00000000`4350822d

dtsagent+3bb10 00000000`02003003 00000000`00000000 00000000`00000000 00000000`00000000

dtsagent+4758d 00000000`43500000 00000000`00000000 00000000`0eba0000 00000000`00000000

dtsagent+48051 00000000`637a9f40 00000000`00000095 00000000`00000000 00000000`00000000

dtsagent+48382 00000000`637a9f50 00000000`637a9f50 00000000`0ebadbe0 00000000`7793a54d

dtsagent!DllRegisterServer+1454 00000000`00000095 00000000`00000000 0002000a`00000004 00000000`634fc808

dtsagent!DllRegisterServer+1084 00000000`0ebaddb0 00000000`634fc808 00000000`634fc801 00000000`00000002

sacommlayer!DllGetClassObject+c031 00000000`634fc800 00000000`634fc830 00000000`59fecb90 00000000`634fc810

sacommlayer!DllGetClassObject+14e10 80000000`00000000 00000000`0ebade10 00000000`00000000 00000000`632e27c8

sacommlayer!DllGetClassObject+1452e 00000000`59fecb90 00000000`59fecb90 00000000`00000095 00000000`637b6820

sacommlayer!DllGetClassObject+b915 00000000`638c4910 00000000`63848778 00000000`63848730 00000000`0ebadfd8

sacommlayer!DllGetClassObject+138b7 00000000`63848710 00000000`00000095 00000000`6343d8d0 00000000`1038b8e8

clientdoc!DllGetClassObject+31795 00000000`63849800 00000000`5a9e52f0 00000000`63849800 00000000`00000000

clientdoc!DllGetClassObject+2d014 00000001`842147b8 00000000`0ebae0c0 00000000`00000000 00000000`00000000

clientdoc!DllGetClassObject+1bd7d 00000000`632e5d40 000007fe`f94d0000 00000000`0ebae160 00000001`842147b8

clientdoc!DllGetClassObject+1f2f6 00000000`171bb470 00000001`c11ba378 000007fe`f8f9d5e0 000007fe`f8e61dd3

clr!DoCLRToCOMCall+177 00000000`632e5d40 00000000`00000001 00000000`00000001 00000000`00000000

0x000007ff`0058e896 00000001`c11ba378 00000000`0ebae310 00000001`c11ba2f0 000007ff`0058e7be

0x000007ff`001b5600 00000001`c11ba2f0 00000000`009a4500 00000000`00000001 00000000`00000001

0x000007ff`001b54de 00000000`00000000 000007ff`00411a98 00000000`00000000 00000000`00000001

System_ni+2b22fb 00000001`c11ba148 000007fe`f8fec22b 00000001`c11ba2f0 00000000`0ebae9d8

0x000007ff`001b51b3 00000001`c11ba148 00000000`00000001 00000000`00000000 00000000`00000000

0x000007ff`001b4ed5 00000001`c11ba148 00000000`00000000 00000000`00000000 00000001`02660018

0x000007ff`001b4e4c 00000001`c11b97d8 88ce68f0`0c88d000 00000000`0ebae9d8 00000000`ffffffff

0x000007ff`01808055 00000001`c11b97d8 00000001`c11b6b50 48ce6911`ca1ae400 000007fe`f7c2d9d4

0x000007ff`00dd20cd 00000001`bff0b3f0 08ce68f0`1f45ff80 00000001`02660000 00000000`00000000

0x000007ff`00dd1b07 00000001`7f2b5e20 00000000`00000000 80000000`00000000 00000000`0ebae7f8

mscorlib_ni+383178 00000001`c0be30a0 00000001`02660018 00000000`000000aa 80000000`00000000

clr!CallDescrWorker+84 00000000`171bb470 000007fe`f8ebb879 00000000`0ebaeae0 00000000`00000000

clr!CallDescrWorkerWithHandler+a9 00000000`0ebae9c8 00000000`00000002 00000000`0ebae9e0 00000000`0ebaebd8

clr!MethodDesc::CallDescr+2a1 00000001`0265ff70 00000000`00000000 00000000`0ebaee48 00000000`0ebaec80

clr!ExecuteCodeWithGuaranteedCleanupHelper+152 00000001`0265ff70 000007fe`f7c3f3d5 00000000`171bb470 00000000`00000000

clr!ReflectionInvocation::ExecuteCodeWithGuaranteedCleanup+1a5 00000001`809f8bf8 00000001`7f29ae70 00000001`ff378360 00000000`00000001

mscorlib_ni+3717e1 00000001`809f8bf8 00000000`00000000 00000000`00fe42e0 00000000`00000025

mscorlib_ni+3ed0b7 00000001`809f8bf8 00000000`77822c7a 00000000`099d1a70 00000000`00000000

clr!CallDescrWorker+84 00000000`00000000 00000000`00fe58c0 00000000`171bb470 00000000`00000000

clr!CallDescrWorkerWithHandler+a9 00000000`0ebaf318 000007fe`00000001 000007fe`f7ba65b0 00000000`00000000

clr!DispatchCallDebuggerWrapper+74 00000001`02643388 00000001`8070c490 00000001`02643388 00000000`0ebaf2a0

clr!DispatchCallNoEH+7c 00000000`0ebaf948 00000000`0ebaf901 00000000`0ebaf8d0 00000000`171bb470

clr!AddTimerCallback_Worker+85 00000001`809f8bf8 00000001`809f8bf8 80000000`00000000 00000000`171bb470

clr!QueueUserWorkItemManagedCallback+92 00000000`00000000 00000001`02643388 000007fe`f54c15c8 00000000`0ebaf3a0

clr!EEUtf8HashTableHelper::Hash+e8 00000000`171bb868 000007fe`f8f36a5e 80000000`00000000 00000000`0ebaf528

clr!IncCantStopCount+bd 00000000`0ebaf678 00000000`171bb470 00000000`00000000 00000000`171bb470

clr!SVR::gc_heap::generation_limit+45 00000000`00000000 00000000`02020080 00000000`16f5cc10 00000000`171bb470

clr! ?? ::FNODOBFM::`string'+afb8a 00000000`00000006 00000000`0ebaf8d0 00000000`0ebaf8d0 00000000`171bb470

clr!QueueUserWorkItemManagedCallback+c7 00000000`00000000 000007fe`00000001 00000000`16f5cc10 000007fe`f98820f2

clr!EEUtf8HashTableHelper::Hash+e8 00000000`1d375917 000007fe`f9882113 00000000`0ebaf8b0 000007fe`f950130c

clr!IncCantStopCount+bd 80000000`00000000 00000000`171bb470 00000000`00000000 00000000`00000001

clr!COMArrayInfo::GetReference+12b 000007fe`f95012c0 00000000`00000007 00000000`0ebaf960 00000000`00000000

clr!AddTimerCallbackEx+77 00000000`171bb470 00000000`0ebafa40 000007fe`f96df0d0 000007fe`f8f1477e

clr!ThreadpoolMgr::AsyncTimerCallbackCompletion+49 000007fe`f8f14a48 00000000`0ebafa40 00000000`00000000 000007fe`f96df0d0

clr!UnManagedPerAppDomainTPCount::DispatchWorkItem+181 00000000`171bb470 00000000`00000001 00000000`00000000 00000000`0d1e0409

clr!ThreadpoolMgr::NewWorkerThreadStart+2e5 00000000`00000001 00000000`1323f901 00000002`00000409 00000002`000d007b

clr!ThreadpoolMgr::WorkerThreadStart+3b 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000

clr!Thread::intermediateThreadProc+7d 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000

kernel32!BaseThreadInitThunk+d 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000

ntdll!RtlUserThreadStart+1d 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000

0 Kudos

Hi Charles,

Try a simple app without using any of those ICE classes, could be an issue with that part.

The only time I've seen WEB or Windows app crash on the Close method is if you try to close the report while it's busy. For example, if someone virtually sends a SELECT . to the DB server which can take more than the default 20 minute IIS session timeout to start returning data, then it appears CR is not responding but it's simply waiting for the data to come back and it is busy. For a Windows app it's not a problem but for a WEB app it can be.

Do you you know exactly what the User did to cause his/her session to crash IIS?

Do you have logging built into your app so you can see what Calls/routines are being executed before the crash?

Thank you

Don

charles_gagnon
Participant
0 Kudos

Hello Don,

Is there a way to know if the report object is busy to avoid doing the close if the object is still fetching data?

Basically the users were testing different reports in our Web Application. The Main Report should have completed is request because we do a RptDoc.HasRecords and the session cleanup can only be activated after this line has return.

The ICE class is our project where we are managing all our sessions.

I will try to test in a little project.

Thank you.

Charles.

0 Kudos

Search Kbase system on Progress Dialog and it should point you to an article on how to enable it. You can then use that info if it's busy. It does work for the WEB viewer.

Don

charles_gagnon
Participant
0 Kudos

Hello Don,

The progress dialog was already enabled in our Web Application. I have done many tests and the reports were never killed when the report object was processing.

I have found something that may cause the issue but I don't understand why it only crashes from time to time. When we are running reports, we are dynamically replacing a subreport to change the Customer logo in the page header of the reports. To do so we are using the inRAS functionality. If I remove this piece of code, the error does not seem to arise when I test in my test web site but i'm waiting for the testers to do another round of reports testing to confirm this hypothesis.

Here is the function where I replace the subreport if you see something wrong with it please let me know. Put it in another reply because it screw the preview.

Thank you.

Charles

Edited by: Charles Gagnon on Nov 10, 2011 5:16 PM

charles_gagnon
Participant
0 Kudos

Function to replace Logo


Private Sub SetRptLogo()
      If Not String.IsNullOrEmpty(LogoObjCd) Then
         Dim strLogoFile As String = System.IO.Path.Combine(ICE.Context.Instance.Session.ReportPath, LogoObjCd & ".RPT")
         If System.IO.File.Exists(strLogoFile) Then
            Dim objReportClientDoc As CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument = Me.RptDoc.ReportClientDocument
            Dim blnFound As Boolean = False
            Dim intLeft As Integer
            Dim intTop As Integer
            Dim intWidth As Integer
            Dim intHeight As Integer
            Dim enuBorderTop As CrystalDecisions.ReportAppServer.ReportDefModel.CrLineStyleEnum
            Dim enuBorderBottom As CrystalDecisions.ReportAppServer.ReportDefModel.CrLineStyleEnum
            Dim enuBorderLeft As CrystalDecisions.ReportAppServer.ReportDefModel.CrLineStyleEnum
            Dim enuBorderRight As CrystalDecisions.ReportAppServer.ReportDefModel.CrLineStyleEnum
            Dim objSection As CrystalDecisions.ReportAppServer.ReportDefModel.Section = Nothing
            Dim strRptName As String = ""

           For Each objReportObject As CrystalDecisions.ReportAppServer.ReportDefModel.SubreportObject In objReportClientDoc.ReportDefController.ReportObjectController.GetReportObjectsByKind(CrystalDecisions.ReportAppServer.ReportDefModel.CrReportObjectKindEnum.crReportObjectKindSubreport)

               'Use SubReportName instead of name as name is assigned automatically without our control if done programmatically
               If objReportObject.SubreportName.Contains("RptLogo") Then
                  strRptName = objReportObject.Name
                  blnFound = True
                  intLeft = objReportObject.Left
                  intTop = objReportObject.Top
                  intWidth = objReportObject.Width
                  intHeight = objReportObject.Height
                  enuBorderTop = objReportObject.Border.TopLineStyle
                  enuBorderBottom = objReportObject.Border.BottomLineStyle
                  enuBorderLeft = objReportObject.Border.LeftLineStyle
                  enuBorderRight = objReportObject.Border.RightLineStyle
                  objSection = objReportClientDoc.ReportDefinition.FindSectionByName(objReportObject.SectionName)
                  objReportClientDoc.ReportDefController.ReportObjectController.Remove(objReportObject)
                  Dim objSubRptClientDoc As CrystalDecisions.ReportAppServer.Controllers.SubreportClientDocument = objReportClientDoc.SubreportController.ImportSubreportEx(strRptName, strLogoFile, objSection, intLeft, intTop, intWidth, intHeight)
                  'Setting Language for Logo either in French or English
                  Try
                     Dim objLang As CrystalDecisions.ReportAppServer.DataDefModel.FormulaField = objSubRptClientDoc.DataDefController.FindFieldByFormulaForm("{@lang_cd}")
                     Dim objModLang As CrystalDecisions.ReportAppServer.DataDefModel.FormulaField = objLang.Clone
                     objModLang.Text = """" & Me.Language & """"
                     objSubRptClientDoc.DataDefController.FormulaFieldController.Modify(objLang, objModLang)
                  Catch ex As System.Threading.ThreadAbortException
                     Throw ex
                  Catch
                     'We Do nothing if this failed
                  End Try
                  Dim strSubRptName As String = objSection.ReportObjects.Item(objSection.ReportObjects.Count - 1).Name
                  Dim objNewSubRpt As CrystalDecisions.ReportAppServer.ReportDefModel.ISCRReportObject = objSection.ReportObjects(strSubRptName).Clone(True)
                  objNewSubRpt.Border.LeftLineStyle = enuBorderLeft
                  objNewSubRpt.Border.RightLineStyle = enuBorderRight
                  objNewSubRpt.Border.TopLineStyle = enuBorderTop
                  objNewSubRpt.Border.BottomLineStyle = enuBorderBottom
                  objReportClientDoc.ReportDefController.ReportObjectController.Modify(objSection.ReportObjects(strSubRptName), objNewSubRpt)
               End If
            Next
         End If 'File exists
      End If

0 Kudos

Hi Charles,

Curious why you are using a subreport for a company logo? Would it not be easier to simply replace the Picture?

To do so see this sample app:

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/500611ed-c366-2b10-4780-878cbf30...

It connects to BOE but you can simply ignore that part of the code.

I recall Dan was tracking a but in a memory leak when using Subreports but I don't recall the details, this may be the cause of IIS crashing also.

I'll have to search to find more info, Dan's on holidays next week so it may be a while before I can get back to you.

Don

charles_gagnon
Participant
0 Kudos

Hello Don,

I can wait for Dan to get back.

When we decided to insert the customer logo, we first tried to use a subreport that was reading a BLOB field from the DB. That proved to be a bad idea because the logo is displayed on each page and the performance impact of reading the logo multiple times on the DB was really bad. So we decided to replace the subreport with a report containing the company logo(no db access) and insert it in the report into our main report in place of the subreport. I will have a look at if we can insert an image instead of using the subreport approach.

Thank you.

Charles.

0 Kudos

Hi Charles,

SP2 is now available, see this link for the info:

Let us know if this resolves the issue.

Thanks

Don

Oops, fixed the link

Edited by: Don Williams on Nov 25, 2011 1:18 PM

charles_gagnon
Participant
0 Kudos

Hello Don,

Your link is pointing to my own forum question.

I have not found the Service Pack 2 for VS 2010 can you give me the proper link.

Thank you.

Charles.

former_member183750
Active Contributor
0 Kudos

- Ludek

charles_gagnon
Participant
0 Kudos

Hello Ludek,

Thank for the link. Any ETA for the list of fixes?

Thank you.

Charles.

former_member183750
Active Contributor
0 Kudos

I hope end of next week - but this is not a promise

- Ludek

0 Kudos

Hi Charles,

Sorry about the link... You'll always find them available on the home page for .NET -

http://www.sdn.sap.com/irj/sdn/crystalreports-dotnet

The one I expect is the cause is this one:

FR: ADAPT01581445 RAS.NET SDK SubreportController.ImportSubreport and ImportSubreportEx leak memory

The SubreportController.ImportSubreport and SubreportController.ImportSubreportEx of the RAS .NET

SDK shouldn't leak memory.

Expected:

The SubreportController.ImportSubreport and SubreportController.ImportSubreportEx methods of the RAS

.NET SDK leak memory when adding a report as a subreport. The leak is more apparent when the report

added has many objects in the report. A blank/empty report doesn't leak much at all.

Please test and let us know if this fixes the issue.

Thanks again

Don

charles_gagnon
Participant
0 Kudos

Hello Don,

I have installed SP2 on my test server to begin testing and I have run into a similar bug even if it's not on the RptDoc.Close but instead on the RptDoc.HasRecord. It may have shed new light on the previously described issue.

When we have started our project with Crystal Report for Visual Studio, we were not using the inRas functionality. Since inRas allowed us powerful report manipulation, we havestarted to add function to manipulate the reports. As an example, we are removing a subreport and replaced it with another one but other functions are still using the ReportDocument functionality. I have already experienced that change made thru inRas were not seen in the ReportDocument.

What I found out in my early test is that if I remove a SubReport with inRas than I do a ReportDocument.HasRecord my Web Application will failed with an unhandled exception even if the HasRecord is enclosed in a tryu2026catchu2026 statement. I have a little application and an IIS Crash Dump if that interested you.

The question I have now is since we are using InRas functionality should we stop using the ReportDocument completely for other report manipulation?

If you have questions or need more information please let me know.

Thanks.

Charles.

charles_gagnon
Participant
0 Kudos

Hello Don,

Any advice about my last post?

Thank you.

Charles.

0 Kudos

Yes, once you start using RAS then use it all the way through your app.

Typically if it crashes on closing there is some method still doing something. Try running DebugDiag and capture IIS crash dump and see what it's complaining about. If you need the CR PDB's I can get them to you but need to know which ones, too many to send them all. And I need specific version of the dll.

Don

Answers (0)