[release/10.0] Test for unloadable ALC frees file lock #120122
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #120066 to release/10.0
/cc @AaronRobinsonMSFT
Customer Impact
This is a customer reported issue in collectible ALCs. The memory within the runtime itself is freed, but on Windows the associated file lock due to
LoadLibrary()remains. The result is the process itself has "freed" all associated resources but the OS still believes the process is using the DLL and thus retains a lock. The OP supplied repro demostrates this by attempting to and failing to delete the file from disk after the ALC is confirmed "collected".Regression
This was the result of a large rewrite in #107224.
Testing
A test was added for this issue.
Risk
Low.