Skip to content

fix: fix Downloader to dispose tempFile and use synchronous IO #81

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

Merged
merged 2 commits into from
Apr 30, 2025

Conversation

spikecurtis
Copy link
Collaborator

@spikecurtis spikecurtis commented Apr 29, 2025

Fixes coder/internal#598

There is a possible race where if the cancellation token is expired, Download() never gets called and the tempFile is never disposed of (at least until GC). We also switch to synchronous IO so that a pending overlapped write won't block the deletion.

These issues can cause races in our tests when we try to clean up the directory.

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@spikecurtis spikecurtis force-pushed the spike/internal-598-temp-dir branch from ee4540b to 08002ef Compare April 29, 2025 12:18
@spikecurtis spikecurtis marked this pull request as ready for review April 29, 2025 12:22
Copy link
Collaborator Author

Hmm. Still getting the error, so clearly the issue I noticed must not be the (only) cause.

@spikecurtis spikecurtis changed the title test: fix DownloaderTest to retry tempdir cleanup fix: fix Downloader to dispose tempFile and use synchronous IO Apr 30, 2025
@spikecurtis spikecurtis merged commit e5d9dc1 into main Apr 30, 2025
4 checks passed
@spikecurtis spikecurtis deleted the spike/internal-598-temp-dir branch April 30, 2025 11:17
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.

flake: DownloaderTest/CancelledInner coder-desktop-windows
2 participants