Update IdentityModel dependency
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
I would like to configure the OpenIdConnectOptions
for each request.
As the OpenIdConnectHandler
requires an IOptionsMonitor
(singleton), I registered the services as scoped like this:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddScoped<IOptionsMonitor<OpenIdConnectOptions>, OptionsMonitor<OpenIdConnectOptions>>();
builder.Services.AddScoped<IOptionsMonitorCache<OpenIdConnectOptions>, OptionsCache<OpenIdConnectOptions>>();
It seems from .NET 6, this way of doing things causes a memory leak (the memory keeps growing):
For my test, I simply inject an instance of IOptionsMonitor<OpenIdConnectOptions>
into a controller and run a bench (a few hundred requests)
.NET 5 results (same test):
It seems also that the issue only concerns OpenIdConnectOptions
(but maybe not) because I tried with a custom options class and I didn’t notice any issue.
Expected Behavior
Same behavior as .NET 5
Steps To Reproduce
The repo to reproduce the issue: https://github.com/ylabade/options-memory-leak
Exceptions (if any)
No response
.NET Version
6.0.101
Anything else?
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:20 (15 by maintainers)
Top Results From Across the Web
.net - updating Microsoft IdentityModel packages to 6.23x ...
Anyone experience an unexpected issue when upgrading your IdentityModel package dependencies? Is this a "bug" or is there another way to get ...
Read more >IdentityModel 6.1.0
Version Downloads Last updated
6.1.0 1,835,027 4 months ago
6.1.0‑preview.6 5,951 5 months ago
6.1.0‑preview.5 6,047 5 months ago
Read more >Nuget package dependency problem Microsoft.IdentityModel ...
This article provides a resolution to a problem with Nuget package dependencies for Microsoft.IdentityModel.Tokens.Jwt with the upgrade to ...
Read more >Microsoft Security Advisory 3214296
IdentityModel.Tokens is a direct dependency. Update its version to 5.1.1 to download a version of this package that isn't affected.
Read more >Volo.Abp.IdentityModel
Install -Package Volo.Abp.IdentityModel. Then add the AbpIdentityModelModule dependency to your module class as shown in the following example: using Volo.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The good news is that updating the dependency in AspNetCore servicing isn’t required, customers can update the IdentityModel dependency locally.
@sebastienros IdentityModel doesn’t have a good track record with breaking changes, we’d definitely want to test this in 7.0 first.