dotnet / dotnet/msbuild

Investigate and fix TaskRegistry infinite loop due to Dictionary concurrency issue

Open
#11,375 0 comments 0 reactions 0 assignees View on GitHub
Area: Performance triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Context

Unguarded concurrent access to Dictionary can lead to infinite loop on reading when the underlying data has been changed (https://www.tessferrandez.com/blog/2009/12/21/high-cpu-in-net-app-using-a-static-generic-dictionary.html)

We've had similiar issues in `TaskRegistry` that we've been fixing recently: https://github.com/dotnet/msbuild/pull/9032

Some of the issues still remain:

https://prism.vsdata.io/failuregroup/?query=ch%3Drelease%20r%3D17.12&eventType=cpu&failureType=dualdirection&failureGroupId=60ca1d45-9aa0-48e0-b9a9-f149de98ab4e

### Goal

Investigate where exactly is the issue occuring.
Investigate why it is still possible to have concurrent access to the Dictionaries within `TaskRegistry`
Attempt to prevent those without blindly making Dictionaries concurrent (as we should understand the concurency model of our structures, and TaskRegistry was understood to be immutable after initial creation)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.