DryIoc: Validate method call hangs
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:
dryioc.webapi.owin 4.0.0
dryioc.webapi 4.0.0
dryioc.web 4.0.0
dryioc.mvc 4.0.0
dryioc 4.0.4

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:
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73
at \DryIoc\Expression.cs(73)
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837
at \DryIoc\Expression.cs(837)
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854
at \DryIoc\Expression.cs(854)
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852
at \DryIoc\Expression.cs(852)
App.Ioc.dll!FastExpressionCompiler.LightExpression.LambdaExpression.ToLambdaExpression() Line 1229
at \DryIoc\Expression.cs(1229)
App.Ioc.dll!FastExpressionCompiler.LightExpression.LambdaExpression.ToExpression() Line 1226
at \DryIoc\Expression.cs(1226)
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73
at \DryIoc\Expression.cs(73)
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837
at \DryIoc\Expression.cs(837)
App.Ioc.dll!FastExpressionCompiler.LightExpression.MethodCallExpression.ToExpression() Line 893
at \DryIoc\Expression.cs(893)
App.Ioc.dll!FastExpressionCompiler.LightExpression.UnaryExpression.ToExpression() Line 566
at \DryIoc\Expression.cs(566)
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73
at \DryIoc\Expression.cs(73)
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837
at \DryIoc\Expression.cs(837)
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854
at \DryIoc\Expression.cs(854)
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852
at \DryIoc\Expression.cs(852)
App.Ioc.dll!FastExpressionCompiler.LightExpression.LambdaExpression.ToLambdaExpression() Line 1229
at \DryIoc\Expression.cs(1229)
App.Ioc.dll!FastExpressionCompiler.LightExpression.LambdaExpression.ToExpression() Line 1226
at \DryIoc\Expression.cs(1226)
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73
at \DryIoc\Expression.cs(73)
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837
at \DryIoc\Expression.cs(837)
App.Ioc.dll!FastExpressionCompiler.LightExpression.MethodCallExpression.ToExpression() Line 893
at \DryIoc\Expression.cs(893)
App.Ioc.dll!FastExpressionCompiler.LightExpression.UnaryExpression.ToExpression() Line 566
at \DryIoc\Expression.cs(566)
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73
at \DryIoc\Expression.cs(73)
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837
at \DryIoc\Expression.cs(837)
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854
at \DryIoc\Expression.cs(854)
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852
at \DryIoc\Expression.cs(852)
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73
at \DryIoc\Expression.cs(73)
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837
at \DryIoc\Expression.cs(837)
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854
at \DryIoc\Expression.cs(854)
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852
at \DryIoc\Expression.cs(852)
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73
at \DryIoc\Expression.cs(73)
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837
at \DryIoc\Expression.cs(837)
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854
at \DryIoc\Expression.cs(854)
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852
at \DryIoc\Expression.cs(852)
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73
at \DryIoc\Expression.cs(73)
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837
at \DryIoc\Expression.cs(837)
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854
at \DryIoc\Expression.cs(854)
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852
at \DryIoc\Expression.cs(852)
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73
at \DryIoc\Expression.cs(73)
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837
at \DryIoc\Expression.cs(837)
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854
at \DryIoc\Expression.cs(854)
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852
at \DryIoc\Expression.cs(852)
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73
at \DryIoc\Expression.cs(73)
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837
at \DryIoc\Expression.cs(837)
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854
at \DryIoc\Expression.cs(854)
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852
at \DryIoc\Expression.cs(852)
App.Ioc.dll!FastExpressionCompiler.LightExpression.LambdaExpression.ToLambdaExpression() Line 1229
at \DryIoc\Expression.cs(1229)
App.Ioc.dll!FastExpressionCompiler.LightExpression.LambdaExpression.ToExpression() Line 1226
at \DryIoc\Expression.cs(1226)
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73
at \DryIoc\Expression.cs(73)
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837
at \DryIoc\Expression.cs(837)
App.Ioc.dll!FastExpressionCompiler.LightExpression.MethodCallExpression.ToExpression() Line 893
at \DryIoc\Expression.cs(893)
App.Ioc.dll!FastExpressionCompiler.LightExpression.UnaryExpression.ToExpression() Line 566
at \DryIoc\Expression.cs(566)
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression<DryIoc.FactoryDelegate>.ToLambdaExpression() Line 1252
at \DryIoc\Expression.cs(1252)
App.Ioc.dll!DryIoc.ContainerTools.GenerateResolutionExpressions(DryIoc.IContainer container, System.Func<System.Collections.Generic.IEnumerable<DryIoc.ServiceRegistrationInfo>, System.Collections.Generic.IEnumerable<DryIoc.ServiceInfo>> getRoots, bool allowRuntimeState) Line 3115
at \DryIoc\Container.cs(3115)
App.Ioc.dll!DryIoc.ContainerTools.Validate(DryIoc.IContainer container, System.Func<DryIoc.ServiceRegistrationInfo, bool> condition) Line 3150
at \DryIoc\Container.cs(3150)
Web.App.Rest.API.dll!App.Rest.API.WebApiConfig.Register(System.Web.Http.HttpConfiguration config) Line 54
at C:\git\App3\Web.App.Rest.API\App_Start\WebApiConfig.vb(54)
Web.App.Rest.API.dll!App.Rest.API.Startup.Configuration(Owin.IAppBuilder app) Line 30
at C:\git\App3\Web.App.Rest.API\Startup.vb(30)
[External Code]
Stack2:
App.Ioc.dll!FastExpressionCompiler.LightExpression.LambdaExpression.ToLambdaExpression() Line 1229 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.LambdaExpression.ToExpression() Line 1226 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.MethodCallExpression.ToExpression() Line 893 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.UnaryExpression.ToExpression() Line 566 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.LambdaExpression.ToLambdaExpression() Line 1229 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.LambdaExpression.ToExpression() Line 1226 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.MethodCallExpression.ToExpression() Line 893 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.UnaryExpression.ToExpression() Line 566 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.LambdaExpression.ToLambdaExpression() Line 1229 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.LambdaExpression.ToExpression() Line 1226 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.MethodCallExpression.ToExpression() Line 893 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.UnaryExpression.ToExpression() Line 566 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToNewExpression() Line 854 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.NewExpression.ToExpression() Line 852 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.LambdaExpression.ToLambdaExpression() Line 1229 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.LambdaExpression.ToExpression() Line 1226 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression.ToExpressions(System.Collections.Generic.IReadOnlyList<FastExpressionCompiler.LightExpression.Expression> exprs) Line 73 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.ArgumentsExpression.ArgumentsToExpressions() Line 837 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.MethodCallExpression.ToExpression() Line 893 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.UnaryExpression.ToExpression() Line 566 C#
App.Ioc.dll!FastExpressionCompiler.LightExpression.Expression<DryIoc.FactoryDelegate>.ToLambdaExpression() Line 1252 C#
App.Ioc.dll!DryIoc.ContainerTools.GenerateResolutionExpressions(DryIoc.IContainer container, System.Func<System.Collections.Generic.IEnumerable<DryIoc.ServiceRegistrationInfo>, System.Collections.Generic.IEnumerable<DryIoc.ServiceInfo>> getRoots, bool allowRuntimeState) Line 3115 C#
App.Ioc.dll!DryIoc.ContainerTools.Validate(DryIoc.IContainer container, System.Func<DryIoc.ServiceRegistrationInfo, bool> condition) Line 3150 C#
Web.App.Rest.API.dll!App.Rest.API.WebApiConfig.Register(System.Web.Http.HttpConfiguration config) Line 54 Basic
Web.App.Rest.API.dll!App.Rest.API.Startup.Configuration(Owin.IAppBuilder app) Line 30 Basic
[External Code]
We are running on .Net 4.6.1 Framework.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (16 by maintainers)
Commits related to this issue
- fixed: #133 Validate method call hangs — committed to Leszek-Kowalski/DryIoc by dadhi 5 years ago
@Havunen,
I have fixed both #133 and #134 and released v4.0.5-preview-01. Could you please check. If everything is working I will release v4.0.5.
I see many
ToExpressionconversion calls in the stack trace. So, try to runcontainer.With(rules => rules.WithoutFastExpressionCompiler()).Validate(...). Hmm, you don’t need the FEC for Validate as you don’t compile anything. I will fix it in DryIoc.