-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
Validate method call hangs #133
Comments
It seems like its going through root class https://github.com/dadhi/DryIoc/blob/master/src/DryIoc/Container.cs#L3100-L3106 variable root is: |
Thanks for letting me know. Will check. |
hmm, It might be that this is not actually infinite loop. It just takes enormous amount of memory to complete |
After inspecting the values more I noticed there are some strange types in the roots list. For example there is 152 objects of following type:
And 153 objects of IHttpController type:
Those are base classes for our Rest controllers, which inherit from our ApiControllerBase which inherits from System.Web.Http.ApiController and that implements IHttpController type. Are those types supposed to be there that many times? It seems like all the top level controller types are there also HeartbeatController, FilesController etc. |
May be we can do some filtering in Validate. You may specify the specific roots. |
I just installed dotMemory, I need to check why its allocating so much and why its not cleaning the objects. |
I see many |
@dadhi I created Container class following way: (visual basic) Dim container = New Container(Function(rules) rules.WithoutFastExpressionCompiler().With(FactoryMethod.ConstructorWithResolvableArguments)).WithWebApi(config) And memory usage is still huge. |
Thanks for checking |
This issue occurs because And those Roots hold reference to other expressions, causing my Computer 32Gb Ram not being enough to handle validation call. When not adding the Roots to result object ( which validation does not use them anyway ) then it goes through using 2gb ram. Old: result.Roots.Add(root.Pair(expr.WrapInFactoryExpression()
#if SUPPORTS_FAST_EXPRESSION_COMPILER
.ToLambdaExpression()
#endif
)); Changed: root.Pair(expr.WrapInFactoryExpression()
#if SUPPORTS_FAST_EXPRESSION_COMPILER
.ToLambdaExpression()
#endif
); But this is public API and same issue would happen when directly calling Is there some reason why roots need to hold reference to all generated objects disallowing GC to remove them? |
Hmm, maybe not. |
Validation is really fast now and barely uses any memory! This is working :) |
DryIoc v4.0.5 is released on NuGet. |
Hi!
When calling
container.Validate()
method dryIoc seems to allocate memory until everything is gone and crashes the application. We have large application so its difficult to give exact steps to reproduce the issue, but I will continue investigating and post here the findings.We are using following DryIoc packages:
We are first registering our services and then calling
container.Validate()
method. This call seems to take forever and eventually crashes due to system being out of memory.I have collected some call stacks of the issue by pausing it using debugger.
Stack1:
Stack2:
We are running on .Net 4.6.1 Framework.
The text was updated successfully, but these errors were encountered: