-
Notifications
You must be signed in to change notification settings - Fork 152
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
Singleton implementations are caching ThreadAbortException #731
Comments
Although that would indeed fix your problem, it would introduce a different problem. Such change would break the guarantee of there ever be a single instance created. So this is, unfortunately, not an option. I'm afraid that the only way to fix this, is by reimplementing |
Yes, this is how we dealt with the problem too. We created our own custom Lazy implementation that does not cache Exceptions due to the insidious problems that it creates at scale. I suppose our only other option is to catch these particular exceptions, and discard the SimpleInjector container. |
I will try to create a patch release that fixes the problem. In the meantime, a workaround you can use is calling |
Ahh ok, that is a good workaround. We aren't calling verify currently at startup, only in unit tests. Thank you Steven! |
I will keep you updated on progress, but do note that this might take some time for me to fix as this runs deep through the codebase. |
Thank you! This is the only issue we have with SimpleInjector at the moment. It performs at high scale with minimal latency impact. |
bug-731 branch created. |
I pushed v4.6.2 to NuGet that fixes this issue. |
Thank you! We'll upgrade as soon as possible. |
We're using Simple Injector at extremely high scale (6 digits in servers, 300 billion requests/day). On a couple servers a day, we are seeing issues where IIS is issuing a ThreadAbort in the middle of Singleton instantiation. This hurts one request, but Simple Injector's use of
Lazy<T>
caches theThreadAbortException
**for all subsequent calls.The only way to recover the process is to restart it.
Can we have a fix to change the
Lazy<T>
usage in Simple Injector fromExecutionAndPublication
toPublicationOnly
so that Exceptioning instantiations are retried instead of cached?The text was updated successfully, but these errors were encountered: