Status/Resolution/Reason: To Fix/Withdrawn/Investigate
Reporter/Name(from Bugbase): Trevor Cotton / Trevor Cotton ()
Created: 09/27/2017
Components: Document Management, Office Integration
Versions: 11.0
Failure Type: Memory Leak
Found In Build/Fixed In Build: 11 update 9, 11 update 12, 11 update 13, 2016 update 3, 2016 update 5 /
Priority/Frequency: Normal / All users will encounter
Locale/System: English / Linux SuSE
Vote Count: 2
Problem Description:
Generating a spreadsheet and not saving it to disk will cause the heap memory to not be freed up causing an eventual server hang
Steps to Reproduce:
Example code to read from a database, create spreadsheet and stream to the user. With a 100,000 row, 5 column database and a heap size of 2GB, running this code four times will consume all of the heap and CF will hang.
<cfset spreadsheet = spreadSheetNew("Report",True)>
<cfset spreadsheetAddRow(spreadsheet,"Id,Name,Date,State,Zip")>
<cfquery name="MyQuery" datasource="test1">
SELECT id, Name, Date, State, Zip
FROM myTable
</cfquery>
<cfset spreadSheetAddrows(spreadsheet,myQuery)>
<cfset spreadsheetFormatRow(spreadsheet,
{
bold=true,
fontsize=12
},
1)>
<cfset filename = "Report.xlsx">
<cfheader name="content-disposition" value="attachment;filename=#filename#">
<cfcontent type="application/msexcel"variable="#spreadsheetReadBinary(spreadsheet)#"reset="true">
Actual Result:
Memory is not freed up after code is executed. Heap will fill up and GC will not be able to recover memory.
Expected Result:
Memory should be freed up after the code is executed.
Any Workarounds:
Write spreadsheet to disk, read back in, stream to client, delete temporary file.
e.g.
<cfset spreadsheet = spreadSheetNew("Report",True)>
<cfset spreadsheetAddRow(spreadsheet,"Id,Name,Date,State,Zip")>
<cfquery name="MyQuery" datasource="test1">
SELECT id, Name, Date, State, Zip
FROM myTable
</cfquery>
<cfset spreadSheetAddrows(spreadsheet,myQuery)>
<cfset spreadsheetFormatRow(spreadsheet,
{
bold=true,
fontsize=12
},
1)>
<cfset spreadsheetWrite(spreadsheet,"/var/www/html/report.xlsx","yes")>
<cfset spreadsheet = spreadsheetRead("/var/www/html/report.xlsx", "Report")>
<cfset filename = "Report.xlsx">
<cffile action="delete" file="/var/www/html/report.xlsx">
<cfheader name="content-disposition" value="attachment; filename=#filename#">
<cfcontent type="application/msexcel" variable="#spreadsheetReadBinary(spreadsheet)#" reset="true">
Attachments:
Comments: