-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
GeneratedInstance is not thread-safe #258
Comments
@starteleport Sorry for being so late, but I just saw this. Wouldn't you need the lock and ConcurrentDictionary though? For the sake of scoping, you cannot ever allow more than one resolver to be built. |
We're encountering this same issue when accessing the service provider within our health checks. And yes the lock and |
@jeremydmiller For some reason I missed that the 5.0 version is multi-targeting |
…lth check request using Microsoft's OOTB health check service which runs the health check registrations in parallel
…entDictionary to prevent the thread safety race condition from occurring
…k request using Microsoft's OOTB health check service which runs the health check registrations in parallel
…onary to prevent the thread safety race condition from occurring
I've encountered the following error with built-in ASPNET Core (netcoreapp3.1) healthchecks engine.
I've got several MongoDB healthchecks that are registered as Scoped. DefaultHealthCheckService starts all the healthchecks in parallel like this:
The problem seems to be that lambda returned from GeneratedInstance.BuildFuncResolver is not thread-safe. The problem reproduces when:
s.Services.Add
method (here), and then initializes_buckets
array and yet to initialize_entries
array in Dictionary.Inititalizes.Services.TryGetValue
method outside the lock and gets NullReferenceException hereI get rather stable reproduce on NDA'd code base and so far have not succeeded in creating stand-alone repro.
I've got two questions:
GeneratedInstance
switched toConcurrentDictionary
and report whether the problem goes away. Do I need to put effort in reproducing the problem in stand-alone app, or this description is clear enough?Thanks.
The text was updated successfully, but these errors were encountered: