-
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
Increased query memory usage on EFCore 8 RC2 #32052
Comments
@gabynevada thank you for submitting this; if indeed there's a regression here between rc1 and rc2 we'll do whatever we can to fix it before GA. To help with this, is it possible for you to isolate this in a minimal, runnable console program which reproduces the problematic behavior? Just a minimal program with a minimal model that we can use to see this effect. |
@roji Sure, tried for a few hours but no luck replicating on a minimal console app yet. I've seen on the main project that this DoubleBufferCapacity is responsible for most allocations when I use the RC2 library version. On the RC1 or the console app project I don't see the DoubleBufferCapacity method executing at all when profiling. Will try again during the weekend see if I can replicate on the console app.
|
@roji It was tricky but I think I finally managed to reproduce, I could only do it when using a remote database. Used an Azure SQL Managed instance. When I try with a local database I couldn't reproduce. Here is the minimal reproduction: https://github.com/gabynevada/efcore-rc2-memory-regression, tested with about 17 million records. |
@gabynevada Does it still repro if you change options.UseSqlServer(connectionString, b => b.UseAzureSql(false)); Also, does it repro with a local database with this: options.UseSqlServer(connectionString, b => b.UseAzureSql(true)); |
@ajcvickers Yes! b.UseAzureSql(false) fixes the problem on RC2 and b.UseAzureSql(true) repros while using a local database. |
@AndriySvyryd We should consider reverting the auto-detection of this based on connection string. |
EF Triage: We will revert the breaking change that enabled a retrying execution strategy for Azure SQL connection strings, but we will keep the part that configures the execution strategy behavior based on the connection string if a retrying execution strategy was explicitly configured. Post 8.0 we will warn if an Azure SQL connection string is used without a retrying execution strategy: #32065 |
Does the EF Triage note match what was implemented? If using Azure SQL + EnableRetryOnFailure, will EF 8 configure the specialised retry behaviour based on the connection string or will it need to be opted into with UseAzureSql? |
I'm getting memory buildup problem from RC2 onwards while streaming from an IAsyncEnumerable. (Tested with latest daily build).
I'm using IAsyncEnuerable to stream data from database and save it an Azure Storage account. From RC2 onwards it keeps consuming memory until the process crashes. If I revert back to RC1 the process works as expected and no significant memory buildup occurs.
This is the expected memory allocations if using RC1
This is latest daily build memory allocations
Include your code
Sample code of IAsyncEnumerable
Sample code I'm using to use the IAsyncEnumerable to stream from database query to storage account
Include stack traces
Stack trace for the Out of memory exception
Stack trace for suspicious object allocations
Stacktrace for BufferedDataReader from memory allocation profiling
Include provider and version information
EF Core version: 8.0.0-rtm.23513.13
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 8.0
Operating system: macOS Sonoma
IDE: JetBrains Rider 2023.3 EAP 2
The text was updated successfully, but these errors were encountered: