fix(bing-ads): close CSV file handles in bulk upload zip flow - #7233
Open
Ayush7614 wants to merge 1 commit into
Open
fix(bing-ads): close CSV file handles in bulk upload zip flow#7233Ayush7614 wants to merge 1 commit into
Ayush7614 wants to merge 1 commit into
Conversation
createActionFile retained an unclosed *os.File behind CSVWriter, and convertCsvToZip reopened the CSV without closing either handle before Remove. Track CSVFile, close it before zip conversion, defer-close the read handle, and clean up open handles on createZipFile error paths.
|
Thank you @Ayush7614 for contributing this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
createActionFilekept an unclosed*os.FilebehindCSVWriterfor the lifetime of each action fileconvertCsvToZipreopened the CSV for reading without closing either the write or read handle beforeos.RemoveCSVFileonActionFileInfo, close it before zip conversion,defer-close the read handle, clean up open handles oncreateZipFileerror paths, and close+remove on template creation failureTest plan
go test ./router/batchrouter/asyncdestinationmanager/bing-ads/audience/ -run TestConvertCsvToZipClosesHandles -vgo test ./router/batchrouter/asyncdestinationmanager/bing-ads/offline-conversions/ -run TestConvertCsvToZipClosesHandles -vSecurity