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

Increase TempFile robustness on Windows #1256

Merged
merged 3 commits into from
Jun 27, 2022

Conversation

jorgenpt
Copy link
Contributor

This addresses GH-1250 -- it replaces the Drop implementation of TempFile with one that uses FILE_FLAG_DELETE_ON_CLOSE to defer deletion until the last handle is closed on Windows.

This also adds some error logging when TempFile's drop fails -- not sure if that's appropriate? It'll help catch issues like this.

Use `FILE_FLAG_DELETE_ON_CLOSE` to delete `TempFile`s on Windows, which
will work even if there's an open handle. I wasn't able to isolate this
into a specific test case, but in local tests of `upload-dif` this
successfully fixes getsentryGH-1250.
src/utils/fs.rs Outdated Show resolved Hide resolved
@kamilogorek kamilogorek merged commit 41ffa8a into getsentry:1.x Jun 27, 2022
kamilogorek pushed a commit that referenced this pull request Jun 27, 2022
* Add some rudimentary tests for `TempFile`
* Windows: Make `TempFile`'s `Drop` more robust

Use `FILE_FLAG_DELETE_ON_CLOSE` to delete `TempFile`s on Windows, which
will work even if there's an open handle. I wasn't able to isolate this
into a specific test case, but in local tests of `upload-dif` this
successfully fixes GH-1250.
kamilogorek added a commit that referenced this pull request Jun 28, 2022
* Add some rudimentary tests for `TempFile`
* Windows: Make `TempFile`'s `Drop` more robust

Use `FILE_FLAG_DELETE_ON_CLOSE` to delete `TempFile`s on Windows, which
will work even if there's an open handle. I wasn't able to isolate this
into a specific test case, but in local tests of `upload-dif` this
successfully fixes GH-1250.

Co-authored-by: Jørgen P. Tjernø <jorgen@tjer.no>
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.

None yet

3 participants