-
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
Possible memory leak when use PooledDbContextFactory #32652
Comments
/cc @AndriySvyryd |
Reset StateManager and DatabaseFacade more consistently Fix functional tests so they actually return the context to pool. Fixes #32652
Reset StateManager and DatabaseFacade more consistently Fix functional tests so they actually return the context to pool. Fixes #32652
Reset StateManager and DatabaseFacade more consistently Fix functional tests so they actually return the context to pool. Fixes #32652
Will this make it into a EF Core 8 patch? If not, is the call to ctx.ChangeTracker.Clear(); enough to mitigate this issue? |
@MoMack20 no, unfortunately, calling |
@mu88 Looking at the milestone, it should be fixed in version 9.0. I have given up using PooledDbContext, and the non-pooled performance is also very good. |
Issue Description:
I have encountered a memory dump issue during my stress test. The memory dump shows that there are 95000 instances of EntityFrameworkCore.Update.ColumnModification held by 239 DbContext objects in the pool.
I have investigated the source code and found that in the TopologicalSort method of CommandBatchPreparer, it clears the _modificationCommandGraph field which stores all the commands from the last time only when a new BatchCommands invoked. Can this be cleared after the SaveChangesAsync() method instead?
Code snippet:
System Information:
The text was updated successfully, but these errors were encountered: