Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temp files created at /tmp are not cleaned up #1062

Closed
sandeepatil1288 opened this issue Nov 16, 2021 · 6 comments
Closed

Temp files created at /tmp are not cleaned up #1062

sandeepatil1288 opened this issue Nov 16, 2021 · 6 comments

Comments

@sandeepatil1288
Copy link

I am using excelize to read a bunch of xls/xlsx files.

Following is the outline of the usage,

f, err := excelize.OpenFile("Book1.xlsx")
if err != nil {
return
}

rows, err := f.GetRows("Sheet1")
if err != nil {
fmt.Println(err)
return
}

for _, row := range rows {
for _, colCell := range row {
fmt.Print(colCell, "\t")
}
fmt.Println()
if
break;
}

Issue Observed:
During reading of the files some temporary files are created like, excelize-1448635484 at the following path, /tmp/ and never gets cleaned up.
This is leading to eating up the memory of system causing more problems.

Go Version: 1.16

Excelize Version: 2.4.1

Can someone please share us some insight on what is causing the temp file creations and what is preventing from the same being cleared.?

@sandeepatil1288 sandeepatil1288 changed the title Temp files created at /tmp/merged and /tmp/diff/ are not cleaned up Temp files created at /tmp are not cleaned up Nov 16, 2021
@xuri
Copy link
Member

xuri commented Nov 16, 2021

Thanks for your feedback, are you sure you're using the version 2.4.1? Excelize only created temporary files when using the stream writer to create the spreadsheet in the version 2.4.1, call Flush function after streaming writing finished, it will be cleanup the temporary files, reading data with GetRows won't be touch the temporary files, and note that, after commit 790c363 (this breaking change will be released in the next version), temporary files maybe created when reading data (depends on data scale and open options WorksheetUnzipMemLimit values ) and the user should be close the stream after using the row's iterator, and close the spreadsheet after opening an existing spreadsheet, also reference the issue #833.

@xuri xuri added the needs more info This issue can't reproduce, need more info label Nov 16, 2021
@sandeepatil1288
Copy link
Author

Thanks for the quick response.
I am confirming the details requested,
Exact tag we are on is, v2.4.1-35-g58fd279.
Package usage(Code details) is as mentioned in the description of the issue.
Only APIs used are,
-> excelize.OpenFile()
-> f.GetRows()

One point to note is that, rows([][]string) returned by GetRows are sometimes not fully iterated through.
Hope that doesn't make any difference.

Please help us on how to avoid these temp files from flooding the system.

@xuri
Copy link
Member

xuri commented Nov 23, 2021

Hi @sandeepatil1288, could you provide your input file attachment without confidential info?

@sandeepatil1288
Copy link
Author

Hi @xuri,
I am attaching the input file samples, on reading which we are seeing the issue.
ExcelizeInputFileSamples.zip

@xuri
Copy link
Member

xuri commented Nov 27, 2021

Thanks for your feedback, I haved tested each spreadsheet in your attachment, and it works well, could you show us a complete, standalone example program or reproducible demo? and please try to upgrade to the master branch code, and call Close for each opened spreadsheet.

@xuri
Copy link
Member

xuri commented Apr 26, 2022

It seems still not have enough info of code and attachments to reproduce this issue, so I'll close this issue, if you have any questions, please let me know.

@xuri xuri closed this as completed Apr 26, 2022
@xuri xuri removed the needs more info This issue can't reproduce, need more info label Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants