SSRS 2019大负载HTTP响应失败 如何突破EntityChunkCount 9999限制?
根据2012年发布的StackOverflow相关问题记载,SSRS所使用的Win32 API HTTP服务端函数HttpSendResponseEntityBody()存在硬编码限制:EntityChunkCount参数上限为9999,该值为指向HTTP_DATA_CHUNK结构的指针数组的最大容量。
故障背景
- 故障排查过程中发现,体积约500MB的报表可成功完成渲染,但在HTTP响应返回阶段触发失败
- 该故障涉及一个已稳定运行多年的核心XLSX报表渲染请求,面向部分体量较大的客户生成报表时,开始出现SSRS HTTP响应失败的问题
- 目前已将
web.config中所有客户端最大响应大小、请求超时参数,以及ReportingService的最大HTTP长度、超时配置项均设置为极高数值,仍无法解决故障 - 当前测试环境为SSRS 2019,本次咨询不关注该限制是否已在新版本修复,核心诉求为确认是否存在
web.config、.NET框架配置之外的机器级配置(例如注册表项),可通过修改提升该数据块数量上限
核心报错信息:BaseWorkerRequest::SendHttpResponse(bool), exception=System.ArgumentException: Value does not fall within the expected range
复现步骤
- 封装ReportExecution2005服务,调用指定报表的
Render()方法,本次测试设置超时时间为10小时,渲染格式为xlsx。核心调用代码如下:
ReportRenderResponse result = new ReportRenderResponse(); ReportExecutionService _execService = new ReportExecution.ReportExecutionService { Timeout = request.ReportTimeout }; _execService.Url = request.ServiceUrl; _execService.Credentials = request.Credentials; ParameterValue[] ssrsParams = request.Parameters.Parameters.ToSSRSParameters(); StringBuilder deviceInfo = CreateDeviceInfoForRender(request); string extension; string mimeType; string reportEncoding; string[] streamIDs = null; Warning[] warnings = null; ExecutionInfo reportInfo = _execService.LoadReport(request.ReportPath, null); if (ssrsParams != null) _execService.SetExecutionParameters(ssrsParams, request.ParameterLanguage); _execService.ExecutionHeaderValue = new ExecutionHeader(); _execService.ExecutionHeaderValue.ExecutionID = reportInfo.ExecutionID; result.Payload = _execService.Render(request.Format.ToSSRSRenderExtension(), deviceInfo.ToString(), out extension, out mimeType, out reportEncoding, out warnings, out streamIDs);
- 构造数据集,发起对应类别的Render请求,测试统计数据如下:
| TimeDataRetrieval(数据检索耗时) | TimeProcessing(处理耗时) | TimeRendering(渲染耗时) | Source(数据源) | Status(状态) | ByteCount(字节数) | RowCount(行数) |
|---|---|---|---|---|---|---|
| 283278 | 1123501 | 5404015 | Live(生产环境) | rsSuccess | 442238838 | 3446298 |
| 293679 | 1086177 | 5333539 | Live | rsSuccess | 442238838 | 3446298 |
| 373011 | 1083059 | 5268298 | Live | rsSuccess | 442238838 | 3446298 |
| 286151 | 955929 | 5068241 | Live | rsSuccess | 442238838 | 3446298 |
| 320936 | 1097187 | 5191568 | Live | rsSuccess | 442238838 | 3446298 |
| 334839 | 1038722 | 4778627 | Live | rsSuccess | 442238838 | 3446298 |
- 查看ReportService日志,可获取如下错误日志:
rshost!rshost!340c!07/13/2022-11:47:12:: e ERROR:
HttpPipelineCallback::SendResponse(): failed writing response.
rshost!rshost!340c!07/13/2022-11:47:12:: e ERROR: Failed with win32
error 0x0057, pipeline=0x0000016EC8CA7D60.
httpruntime!ReportServer_0-4!340c!07/13/2022-11:47:12:: e ERROR:
Failed in BaseWorkerRequest::SendHttpResponse(bool),
exception=System.ArgumentException: Value does not fall within the
expected range. at
Microsoft.ReportingServices.HostingInterfaces.IRsHttpPipeline.SendResponse(Void*
response, Boolean finalWrite, Boolean closeConn) at
ReportingServicesHttpRuntime.BaseWorkerRequest.SendHttpResponse(Boolean
finalFlush)
内容的提问来源于stack exchange,提问作者Ross Bush

