-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
rm
: move open DLLs to temp dir to allow dir to be deleted
#53456
rm
: move open DLLs to temp dir to allow dir to be deleted
#53456
Conversation
base/file.jl
Outdated
if err.code==Base.UV_EACCES && endswith(path, ".dll") | ||
# Loaded DLLs cannot be deleted on Windows, even with posix delete mode | ||
# but they can be moved. So move out to allow the dir to be deleted | ||
# and DLL deleted via the temp dir cleanup on next reboot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: tempdir is never cleaned up on Windows
58202e5
to
c79f4b8
Compare
82fb204
to
6b37c5a
Compare
base/file.jl
Outdated
# TODO: Add a mechanism to delete these moved files after dlclose or process exit | ||
dir = mkpath(joinpath(tempdir(), "julia_delayed_deletes")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding something to Pkg.gc()
that checks for this folder and attempts to delete everything inside (silently failing if something is still opened) should work well. Moving it outside of the depot is good in once sense, as it allows the depot to be deleted, but it's bad in another sense in that it's more likely to be on a different disk, which will probably fail the mv()
as I doubt you can move a mmap'ed file across device boundaries. That's probably quite an edge case however.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sounds good JuliaLang/Pkg.jl#3812
This is ready to go from my perspective. Windows CI looks clean. |
83f908a
to
1cc1cb8
Compare
Based on findings in #53394, loaded (memory mapped) DLLs cannot be deleted on Windows, even with posix delete mode, but they can be moved without breaking the loaded library. So move out to the temp dir to allow the dir to be deleted
and the DLL will be deleted via the temp dir cleanup on next reboot.Turns out Windows doesn't tidy up the temp dir automatically.. So this saves them to a fixed temp dir that Pkg.gc will tidy up JuliaLang/Pkg.jl#3812