Skip to content

[Windows] Sporadic "Access is denied. (os error 5)" on version 3.17 #339

@natinimni

Description

@natinimni

Hi @Stebalien,
We have experienced multiple failures after updating tempfile from version 3.16.0 to 3.17.1, and we strongly suspect a recent commit: feat: delete unnamed temporary files on windows immediately .
The issue seems to sporadically happen when attempting to use a newly created temp file. We use tempfile at scale, and immediately after updating from 3.16.0 to 3.17.1 we've started sporadically getting "Access is denied. (os error 5)" errors when trying to use newly created temp files.
We have carefully reviewed our code and made sure we keep the file-handler “alive” all the time, and when we've reverted back to version 3.16.0 (without any other change), the issue completely disappeared.

We suspect that in cases when delete_open_file's call to SetFileInformationByHandle is falling, it may somehow corrupt the file's state, making it inaccessible. Since errors returned by delete_open_file are being ignored (see create in src/file/imp/windows.rs), we cannot tell for sure that this is what happens.

Could you please remove the call to delete_open_file from create ? or alternatively, allow callers of create to pass an argument to skip it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions