-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
ServiceProviderCache keeps initially created IServiceProvider indefinitely #27169
Labels
area-dbcontext
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
regression
Servicing-approved
type-bug
Milestone
Comments
PawelGerr
changed the title
ServiceProviderCache keep initialy created IServiceProvider indefinitely
ServiceProviderCache keeps initially created IServiceProvider indefinitely
Jan 11, 2022
@AndriySvyryd This looks like a consequence of no longer just using the hash. I now remember that this was why we did it the hash way in the first place! |
AndriySvyryd
added a commit
that referenced
this issue
Jan 14, 2022
AndriySvyryd
added
the
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
label
Jan 14, 2022
This was referenced Jan 14, 2022
AndriySvyryd
added a commit
that referenced
this issue
Jan 18, 2022
AndriySvyryd
added a commit
that referenced
this issue
Jan 18, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-dbcontext
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
regression
Servicing-approved
type-bug
The
ServiceProviderCache
uses instances ofIDbContextOptions
as keys for the internalConcurrentDictionary
. A key of typeIDbContextOptions
contains, among other things, the extensionCoreOptionsExtension
which has an_applicationServiceProvider
.After creation and disposal of the first
DbContext
theServiceProviderCache
keeps theIDbContextOptions
incl. the (disposed)IServiceProvider
, which keeps allIDisposable
instances in it. One of the disposables is theDbContext
itself.The result is that the reference
_applicationServiceProvider
prevents GC to reclaim the memory.Repro
Program.cs
csproj file
Provider and version information
EF Core version: 6.0.1
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 6.0
Operating system: Windows 10 x64
IDE: Rider 2021.3.2
The text was updated successfully, but these errors were encountered: