Server Connection Closed on Large Reports

  • First off I understand that it is a horrible idea to run extremely large/long running reports, but sometimes it ends up being the best possible solution due to external forces.

    I've got a 25,000 page report that we recently converted from crystal reports to SSRS. The SSRS server is a 64bit 2003 server with 32 gigs of ram running SSRS 2005. When running the report through the report manager application, it renders in the browser/viewer after about 12 minutes. Exporting to pdf through the browser/viewer in the report manager takes an additional 55 minutes. It does work and it produces a whopping 1.03gb pdf.

    Unfortunately, I've run into a problem when trying to do this from a console application using the web service API. After about 30-35 minutes I get an exception on the client with the following error:

    Exception Message: The underlying connection was closed: An unexpected error occurred on a receive.

    For troubleshooting purposes, I tried creating a web app using the Report Viewer control and after roughly the same amount of time I get this flavor of the same error:

    An existing connection was forcibly closed by the remote host

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

    Source Error:

    Line 51: string extension;

    Line 52:

    Line 53: byte[] bytes = ReportViewer1.ServerReport.Render("pdf", null, out mimeType, out encoding, out extension,

    Line 54: out streamids, out warnings);

    Line 55:

    Source File: [.....] Line: 53

    Stack Trace:

    [SocketException (0x2746): An existing connection was forcibly closed by the remote host]

    System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) +93

    System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +119

    [IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.]

    System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +267

    System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) +25

    System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead) +306

    [WebException: The underlying connection was closed: An unexpected error occurred on a receive.]

    System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request) +314

    System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request) +4

    Microsoft.SqlServer.ReportingServices2005.Execution.RSExecutionConnection.GetWebResponse(WebRequest request) +11

    Microsoft.Reporting.WebForms.ServerReportSoapProxy.GetWebResponse(WebRequest request) +45

    System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +172

    Microsoft.SqlServer.ReportingServices2005.Execution.ReportExecutionService.Render(String Format, String DeviceInfo, String& Extension, String& MimeType, String& Encoding, Warning[]& Warnings, String[]& StreamIds) +68

    Microsoft.SqlServer.ReportingServices2005.Execution.RSExecutionConnection.Render(String Format, String DeviceInfo, String& Extension, String& MimeType, String& Encoding, Warning[]& Warnings, String[]& StreamIds) +146

    Microsoft.Reporting.WebForms.ServerReport.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings) +179

    ReportTest._Default.btnRunReport_Click(Object sender, EventArgs e) in D:\Projects\SandBox\ReportTest\ReportTest\Default.aspx.cs:53

    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105

    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107

    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7

    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11

    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33

    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

    There are no errors or events logged in the report server's event log.

    Here are some things I've tried so far:

    * set the HttpRuntime ExecutionTimeout value to 3 hours on the report server

    * disabled http keep alives on the report server

    * increased the script timeout on the report server

    * set the report to never time out on the server

    * set the report timeout to several hours on the client call

    I came across this interesting post on eggheadcafe:

    http://www.eggheadcafe.com/software/aspnet/31509957/an-existing-connection-wa.aspx

    It would seem that enabling chunking to the client could solve the problem, However, the SSRS client api effectively hides the web service call to the report server, so I cannot solve problem via an override as that post did.

    Any ideas?

  • Look at Site Settings in the Report Manager (http://YourServer/Reports). There's an option Report Execution Timeout which defaults to 1800 seconds.

    Hopes this helps.

    Peter

  • Thanks for the reply. I did set the report execution to never timeout as opposed to the default 1800. I did this both on the global server setting and on the specific report's execution setting.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply