cancel
Showing results for 
Search instead for 
Did you mean: 

Create PDF crashes webapplication

Former Member
0 Kudos

Hi,

We have a website that creates PDF-reports using SAP Crystal Reports runtime engine for .NET Framework 4 (64-bit) SP1. The site runs on Windows 2003 R2 x64.

The site (w3wp.exe) crashes every now and then when a report is generated in PDF. We cannot trace it back to specific reports, users or actions. It seems to be random. We don't have this issue on x86-webservers with the same application and CR-version.

We got a memory dump from one of the crashes. The dump can be found [here|http://www.megaupload.com/?d=ZFVJ7FEZ] (zipped, about 330MB). Microsoft already analyzed this dump and this is the conclusion :

Here is my analysis: as you already noted, the stack goes from the SAP component to msvcr80, based on the method name (without the private symbols we cannot see the arguments passed etcu2026) it looks like they are initializing something which requires memory to be moved around, hence the call to memmove_s

0:076> kpL

Child-SP RetAddr Call Site

00000000`27ceec88 00000000`781b6a70 msvcr80!memcpy(unsigned char * dst = 0x00000000`26bbceb8 "???", unsigned char * src = 0x00000000`26bbceb8 "???", unsigned long count = 0)+0x1ec

00000000`27ceec90 00000000`41d69db4 msvcr80!memmove_s(void * dst = 0x00000000`00000000, unsigned int64 sizeInBytes = 2, void * src = 0x00000000`000001c2, unsigned int64 count = 0)+0x80

00000000`27ceecd0 00000000`41d6b2bc crxf_pdf!UXFInitializeW+0x1834

00000000`27ceed50 00000000`37b2d78f crxf_pdf!UXFGetExportFormatsExW+0x10c

00000000`27ceeda0 00000000`37da9c1a crpe32!CRPEConnectionInit+0x365df

00000000`27ceeef0 00000000`37da0b93 crpe32!MWCleanupProcess+0x4ffca

00000000`27ceefd0 00000000`37da54eb crpe32!MWCleanupProcess+0x46f43

00000000`27cef720 00000000`37d27bb4 crpe32!MWCleanupProcess+0x4b89b

00000000`27cef750 00000000`37d38964 crpe32!CRPEConnectionInit+0x230a04

00000000`27cef820 00000000`37d39a8f crpe32!CRPEConnectionInit+0x2417b4

00000000`27cefb90 00000000`37d39dac crpe32!CRPEConnectionInit+0x2428df

00000000`27cefbe0 00000000`37d3a45c crpe32!CRPEConnectionInit+0x242bfc

00000000`27cefd30 00000000`783917cd crpe32!CRPEConnectionInit+0x2432ac

00000000`27cefe20 00000000`781337d7 mfc80u!_AfxThreadEntry(void * pParam = 0x00000000`23e01f80)+0x101

00000000`27ceff20 00000000`78133894 msvcr80!_callthreadstartex(void)+0x17

00000000`27ceff50 00000000`77d6b71a msvcr80!_threadstartex(void * ptd = 0x00000000`77d6b6e0)+0x84

00000000`27ceff80 00000000`00000000 kernel32!BaseThreadStart(<function> * lpStartAddress = 0x00000000`00000000, void * lpParameter = 0x00000000`00000000)+0x3a

First, itu2019s interesting to note that the destination pointer does not look to be valid; the call to msvcr80!memmove_s comes directly from crxf_pdf!UXFInitializeW (there are no u201Chiddenu201D calls in the middle):

0:076> ln 00000000`41d69db4

(00000000`41d68580) crxf_pdf!UXFInitializeW+0x1834 | (00000000`41d6b1b0) crxf_pdf!UXFGetExportFormatsExW

The exception (an Access Violation) is actually thrown in msvcr80 while it is trying to copy the memory as a result of the move call:

0:076> .exr -1

ExceptionAddress: 000000007814e38c (msvcr80!memcpy+0x00000000000001ec)

ExceptionCode: c0000005 (Access violation)

ExceptionFlags: 00000000

NumberParameters: 2

Parameter[0]: 0000000000000001

Parameter[1]: 000000002c78b280

Attempt to write to address 000000002c78b280

Also looking at the thread registers confirms that the memory address is not valid:

0:076> r

rax=0000000000000009 rbx=0000000000000413 rcx=000000002c78b280

rdx=ffffffffff9329f0 rsi=0000000000000000 rdi=0000000000000002

rip=000000007814e38c rsp=0000000027ceec88 rbp=0000000041dd42b0

r8=0000000005500dc0 r9=0000000005500dc4 r10=000000002728a4c0

r11=000000002728a4c0 r12=0000000041dd42b0 r13=0000000000000001

r14=000000002728a4c0 r15=000000002c78b284

iopl=0 nv up ei pl nz na po nc

cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010204

msvcr80!memcpy+0x1ec:

00000000`7814e38c 8901 mov dword ptr [rcx],eax ds:00000000`2c78b280=????????

Unfortunately without the private symbols we cannot see what that memory belongs to.

Anyway since I have access to all Microsoft private symbols, the fact that I cannot find this specific one I think means this is part of the SAP components. I think we can conclude the problem originates from the crxf_pdf.dll and manifests itself in msvcr80.dll because of some wrong parameter passed into that call.

All help would be very much appreciated.

Many Thanks,

Thomas

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hello,

What version of CR runtime are you using and what version of VS?

CR for VS 2010 is the only version that supports 4.0 Framework and 64 bit runtime unless you are using CR Basic which is included with Visual Studio 2003, 5 and 8 in which they don't support 4.0 either.

What method are you using to export?

Don

Former Member
0 Kudos

Hi Don,

We are using CR for VS 2010 x64 runtime.

The method used is :

CrystalDecisions.CrystalReports.Engine. ReportDocument. ExportToDisk (ExportFormatType formatType, string fileName) - used to save report as PDF/WORD/EXCEL

Thanks !

Thomas

0 Kudos

Hi Thomas,

Since you have RAS available use this code and test again:

private void ExportToPDFRAS_Click(object sender, EventArgs e)

{

//CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

ISCDReportClientDocument rcd;

//rpt.Load("c:
Reports
Group.rpt");

rcd = rptClientDoc;

// Declare a PrintOutputController to allow documents to be exported to PDF

PrintOutputController rasPrintOutputController;

CrReportExportFormatEnum rasReportExportFormat;

CrystalDecisions.Shared.DiskFileDestinationOptions diskOpts = CrystalDecisions.Shared.ExportOptions.CreateDiskFileDestinationOptions();

diskOpts.DiskFileName = "c:
reports
reports1.pdf";

// Set the CrReportExportFormatEnum to export the report as a PDF file.

rasReportExportFormat = CrReportExportFormatEnum.crReportExportFormatPDF;

rasPrintOutputController = rcd.PrintOutputController;

// Use the Export() method of the PrintOutputController to export the report to a ByteArray.

ByteArray tempByteArray = rasPrintOutputController.Export(rasReportExportFormat, 0);

Byte[] byteStreamOutput = tempByteArray.ByteArray;

System.IO.Stream oStream;

byte[] byteArray = null;

oStream = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

byteArray = new byte[oStream.Length];

oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length - 1));

// this is used to verify the file so I saved it to disk

System.IO.File.Create(diskOpts.DiskFileName, Convert.ToInt32(oStream.Length - 1)).Close();

System.IO.File.OpenWrite(diskOpts.DiskFileName).Write(byteArray, 0, Convert.ToInt32(oStream.Length - 1));

System.IO.File.SetAttributes(diskOpts.DiskFileName, System.IO.FileAttributes.Directory);

oStream.Close();

}

CR requires contiguous memory space so for large reports IIS may not be able to handle cleaning up it's memory fragmentation when objects are freed up. It's a common problem with Java app's also, Java doesn't have a good memory manager either.

Because of the lack of ability to pass files through Forums I suggest you purchase a support case if you don't have a Support Contract and work with a Support engineer here to debug the problem. We can get the PDB's for those files to you if that helps MS determine what their issue is...

Thanks

Don

Former Member
0 Kudos

Hi Don,

Unfortunately we don't have RAS, so we cannot implement the code-changes that you suggest.

We decided to buy a support ticket as you suggest and hope to get the issue resolved as quick as possible.

But, if you could get me the private CR-symbols, that would be great.

Many thanks for your help,

Thomas

0 Kudos

Hi Thomas,

Yes you do actually, inProc RAS ( Report Application Server ) is included with CR for VS 2010, just add the assemblies to your project.

using CrystalDecisions.CrystalReports.Engine;

using CrystalDecisions.Shared;

using CrystalDecisions.ReportAppServer.ClientDoc;

using CrystalDecisions.ReportAppServer.Controllers;

using CrystalDecisions.ReportAppServer.ReportDefModel;

using CrystalDecisions.ReportAppServer.CommonControls;

using CrystalDecisions.ReportAppServer.CommLayer;

using CrystalDecisions.ReportAppServer.CommonObjectModel;

using CrystalDecisions.ReportAppServer.ObjectFactory;

using CrystalDecisions.ReportAppServer.DataSetConversion;

using CrystalDecisions.ReportAppServer.DataDefModel;

using CrystalDecisions.ReportSource;

using CrystalDecisions.Windows.Forms;

As for the PDB's they are too large to send directly. Now that you have the case, can you tell me what the case number is?

Don

Former Member
0 Kudos

Ah, OK.. I will check with the developers.

The case number : 3108284 2011

gr.

Thomas

0 Kudos

Hi Thomas,

I sent you a link to download the PDF and CRPE PDBs' from hour FTP Server called SAPMAT. They should be available within the hour.

Deepu can also set you up to upload the Dump file if we need it.

First thing though is to get both WEB Server onto CR SP1 and then verify it's still an issue.

I am curious, which WEB Server did you get the dump from when the crash happened or was it a different PC where the app is running? Was it the SP0 or SP 1 Server?

Thanks again

Don

Former Member
0 Kudos

Hi Don,

Thanks for the symbols. I will check in the debugger if it learns us something new.

The dump comes from the server that has SP1 installed. This is actually the only server that is online now. The application runs on an NLB cluster with 2 nodes. We had this issue on both nodes, but for testing purposes we installed CR SP1 on one node and put the other one offline.

As discussed with Deepu we will now install CR SP1 on the development box also and build the application for x64 (now it's build for "Any CPU").

gr.

Thomas

Answers (0)