Skip to content

Race in scoped services promoted to singleton caching #52863

@pakrym

Description

@pakrym

The #52484 attempted to fix the race where CallSiteRuntimeResolver.Instance.Resolve and compiled service accessors have a different source of truth for a scoped services promoted to singletons caching location.

The former presumes the value is cached in callSite.Value the latter in ResolvedServices dictionary on the scope.

The problem with the fix is that it only tightened the race for directly resolved services but did nothing for indirectly-resolved ones.

For the following chain:

A(Singleton)->B(Scoped)

When A is resolved B is also resolved and cached into the callSite.Value. When a direct compiled accessor for B is executed on the root scope it would bypass the logic in the fix and would use the ResolvedService collection, skipping callSite.Value entirely.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions