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

Add invariant check to InternableString.ExpensiveConvertToString #6798

Merged
merged 3 commits into from
Sep 7, 2021

Conversation

ladipro
Copy link
Member

@ladipro ladipro commented Aug 31, 2021

Fixes AB#1343753

Context

We're getting hang dumps where a lock taken by the concurrent flavor of WeakStringCache is orphaned. This can possibly be caused by InternableString.ExpensiveConvertToString, which is running unsafe code under the lock, throwing a corrupting exception, thus preventing the lock-releasing finally blocks from running.

Changes Made

Since no bug has been found in stress runs and by extensive code inspection, I am adding a cheap invariant check to the unsafe method, hoping that it would help us figure out the issue.

Testing

Smoke-tested the invariant.

@Forgind Forgind added the merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. label Sep 1, 2021
@rainersigwald rainersigwald merged commit f9e7e8e into dotnet:main Sep 7, 2021
@ladipro ladipro deleted the stringtools-add-invariant-check branch September 9, 2021 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants