Skip to content

fix(bing-ads): close CSV file handles in bulk upload zip flow - #7233

Open
Ayush7614 wants to merge 1 commit into
rudderlabs:masterfrom
Ayush7614:fix/bing-ads-close-csv-handles
Open

fix(bing-ads): close CSV file handles in bulk upload zip flow#7233
Ayush7614 wants to merge 1 commit into
rudderlabs:masterfrom
Ayush7614:fix/bing-ads-close-csv-handles

Conversation

@Ayush7614

@Ayush7614 Ayush7614 commented Jul 29, 2026

Copy link
Copy Markdown

Summary

  • createActionFile kept an unclosed *os.File behind CSVWriter for the lifetime of each action file
  • convertCsvToZip reopened the CSV for reading without closing either the write or read handle before os.Remove
  • Track CSVFile on ActionFileInfo, close it before zip conversion, defer-close the read handle, clean up open handles on createZipFile error paths, and close+remove on template creation failure
  • Applies to both Bing Ads audience and offline-conversions packages

Test plan

  • go test ./router/batchrouter/asyncdestinationmanager/bing-ads/audience/ -run TestConvertCsvToZipClosesHandles -v
  • go test ./router/batchrouter/asyncdestinationmanager/bing-ads/offline-conversions/ -run TestConvertCsvToZipClosesHandles -v

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

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.
@contributor-support

Copy link
Copy Markdown

Thank you @Ayush7614 for contributing this PR.
Please sign the Contributor License Agreement (CLA) before merging.

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

Successfully merging this pull request may close these issues.

1 participant