-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Open
Labels
Description
Bug description
Since about the beginning of August we've seen an increasing number of initial command timeouts before getting an new ManagedIdentityCredential.GetToken
that resolves the failing command.


Nothing has changes configuration wise.
Your code
We're using Aspire but with a pooled db context to enable global queries via a context factory
builder.Services.AddPooledDbContextFactory<DatabaseContext>(o =>
{
o.UseSqlServer(builder.Configuration.GetConnectionString("sqldb"), b =>
{
b.EnableRetryOnFailure();
});
o.EnableSensitiveDataLogging(builder.Environment.IsDevelopment());
o.EnableDetailedErrors(builder.Environment.IsDevelopment());
o.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
});
public class DatabaseContextScopedFactory(IDbContextFactory<DatabaseContext> pooledFactory, TenantScopedStore tenantScope) : IDbContextFactory<DatabaseContext>
{
public DatabaseContext CreateDbContext()
{
var context = pooledFactory.CreateDbContext();
context.TenantId = tenantScope.TenantId ?? Guid.Empty;
return context;
}
}
services.AddScoped<DatabaseContextScopedFactory>().AddScoped(sp =>sp.GetRequiredService<DatabaseContextScopedFactory>().CreateDbContext())
Stack traces
Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Unknown error 258
Verbose output
EF Core version
9.0.8
Database provider
Microsoft.EntityFrameworkCore.SqlServer
Target framework
.Net 9.0
Operating system
Azure app service, Linux docker
IDE
Rider