-
-
Notifications
You must be signed in to change notification settings - Fork 835
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
Feature/1077 component registration activating properties autowired #1079
Feature/1077 component registration activating properties autowired #1079
Conversation
When a registration is added during the lookup of a
|
0293e6f
to
520e6bd
Compare
The failing test is This may be an unrelated bug. @tillig any thoughts? |
Entirely from the top of my head, because unfortunately I'm super swamped with the old day job at the moment and all my "free time" was used up by the Autofac 5 release and ensuing set of other releases, bugs, etc... The test in question: [Fact]
public void WhenSeveralThreadsResolveNotAlreadyRegisteredType_DoesNotThrow()
{
for (var i = 0; i < 20_000; i++)
{
var builder = new ContainerBuilder();
builder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource());
var container = builder.Build();
Parallel.Invoke(() => container.Resolve<A>(), () => container.Resolve<A>());
}
} And the failed test error stack trace:
This is potentially related to a recent change @alexmg worked on to try to solve a threading issue where ACTNARS was being problematic (#1073). After inlining, it appears the problem is when it's looking at the That code: if (_serviceInfo.TryGetValue(service, out var existing) && existing.IsInitialized && existing.Implementations.Any())
return existing; My gut feel is that potentially the fix for #1073 without the locking may have been passing... coincidentally? That is, before your changes the ACTNARS register-the-type-on-the-fly was happening fast enough that it would do the whole registration on one thread before the other thread could do its check for
Roughly. I don't know off the top of my head how to fix that. Is there a need for a concurrent collection for the implementations set? How will that affect perf? Is there a better call than ...which, unfortunately, just hit like half an hour so I'm toooootally out on this for now. Perhaps @alexmg, @alistairjevans, @alsami, or one of the other members of the @autofac/autofac org can help. |
Sync autofac/Autofac develop
520e6bd
to
b6340ac
Compare
…events after the 'ComponentRegistry' has been built
…ing_PropertiesAutowired
No description provided.