Skip to content

Fix recurisve Monitor.TryEnter to not return false due to a race condition#77243

Merged
kouvel merged 1 commit into
dotnet:mainfrom
kouvel:MonitorFix
Oct 20, 2022
Merged

Fix recurisve Monitor.TryEnter to not return false due to a race condition#77243
kouvel merged 1 commit into
dotnet:mainfrom
kouvel:MonitorFix

Conversation

@kouvel

@kouvel kouvel commented Oct 20, 2022

Copy link
Copy Markdown
Contributor

A race condition when the object header is transitioning to a sync block can cause a concurrent recursive TryEnter to return false.

Fixes #76660

A race condition when the object header is transitioning to a sync block can cause a concurrent recursive `TryEnter` to return false.

Fixes #76660
@kouvel kouvel added this to the 8.0.0 milestone Oct 20, 2022
@kouvel kouvel requested review from eduardo-vp and mangod9 October 20, 2022 02:05
@kouvel kouvel self-assigned this Oct 20, 2022
@ghost

ghost commented Oct 20, 2022

Copy link
Copy Markdown

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

Issue Details

A race condition when the object header is transitioning to a sync block can cause a concurrent recursive TryEnter to return false.

Fixes #76660

Author: kouvel
Assignees: kouvel
Labels:

area-System.Threading

Milestone: 8.0.0

@kouvel kouvel changed the title Fix recurisve Monitor.TryEnter to not return false due to a condition Fix recurisve Monitor.TryEnter to not return false due to a race condition Oct 20, 2022
@EgorBo

EgorBo commented Oct 20, 2022

Copy link
Copy Markdown
Member

Worth backporting to .NET 7.0?

@kouvel

kouvel commented Oct 20, 2022

Copy link
Copy Markdown
Contributor Author

I don't see a compelling reason for backporting it yet.

@ghost ghost locked as resolved and limited conversation to collaborators Nov 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Monitor.TryEnter sometimes fails even if Monitor.IsEntered returns true

4 participants