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

TaskResultCache incorrectly shares the same lock object for all the keys. #13448

Closed
Erarndt opened this issue May 17, 2024 · 3 comments
Closed
Labels
Priority:2 Issues for the current backlog. Type:Bug

Comments

@Erarndt
Copy link

Erarndt commented May 17, 2024

There is a very subtle bug in TaskResultCache that is causing the same lock object to be used rather than a different one per key. Here's the offending code:

object lockObject = _perTaskLock.GetOrAdd(key, static () => new object());

This erroneously caches the delegate that is used. The intent was to pass in a delegate that will create a new object and cache/lock on that.

Copy link
Contributor

@Erarndt Issue is missing Type label, remember to add a Type label

@dotnet-policy-service dotnet-policy-service bot added the missing-required-type The required type label is missing. label May 17, 2024
@jeffkl jeffkl added Type:Bug Priority:2 Issues for the current backlog. and removed missing-required-type The required type label is missing. labels May 17, 2024
@jeffkl
Copy link
Contributor

jeffkl commented May 17, 2024

🤦

@jeffkl
Copy link
Contributor

jeffkl commented May 20, 2024

Fixed by NuGet/NuGet.Client#5808

@jeffkl jeffkl closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:2 Issues for the current backlog. Type:Bug
Projects
None yet
Development

No branches or pull requests

2 participants