FIX: stop temp file leak in remote dataset loader cache=False path by ManoharPaturi · Pull Request #2842 · microsoft/PyRIT · GitHub
Skip to content

FIX: stop temp file leak in remote dataset loader cache=False path - #2842

Merged
Roman Lutz (romanlutz) merged 2 commits into
microsoft:mainfrom
ManoharPaturi:fix/remote-loader-cache-false-temp-leak
Sep 25, 2026
Merged

Roman Lutz (romanlutz) merged 2 commits into
microsoft:mainfrom
ManoharPaturi:fix/remote-loader-cache-false-temp-leak

Conversation

@ManoharPaturi

Copy link
Copy Markdown
Contributor

Fixes #2841.

the fetched copy is written through a context-managed temp file and unlinked when the loader is done with it, so cache=False fetches stop stranding full dataset copies in the temp directory. same pattern as the #1894 fix for the audio path.

new test asserts no temp file survives a cache=False fetch. fails on main, passes here. loader suite 35/35 green, ruff clean.

With cache=False the loader wrote the fetched dataset to a
NamedTemporaryFile(delete=False) and then immediately dropped the handle,
abandoning a full copy of the data in the system temp directory on every
fetch. Nothing read the file. Skip the pointless write; cache=False simply
does not persist.
Copilot AI balanced review requested due to automatic review settings September 25, 2026 16:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Sep 25, 2026
Merged via the queue into microsoft:main with commit 07739f6 Sep 25, 2026
49 checks passed
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.

Remote dataset loader leaks a temp file per cache=False fetch

3 participants