0

I am using .Net Core 2.2 for my web project. I got test cases which I am executing using dotnet vstest as part of CI pipeline in Linux docker. Sometimes the execution gets failed with below stack:

Error Message:

> OneTimeSetUp: Autofac.Core.DependencyResolutionException : An error
> occurred during the activation of a particular registration. See the
> inner exception for details. Registration: Activator = MvcRouteHandler
> (ReflectionActivator), Services =
> [Microsoft.AspNetCore.Mvc.Internal.MvcRouteHandler], Lifetime =
> Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership =
> OwnedByLifetimeScope ---> An error occurred during the activation of a
> particular registration. See the inner exception for details.
> Registration: Activator = ActionInvokerFactory (ReflectionActivator),
> Services =
> [Microsoft.AspNetCore.Mvc.Infrastructure.IActionInvokerFactory],
> Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared,
> Ownership = OwnedByLifetimeScope ---> An error occurred during the
> activation of a particular registration. See the inner exception for
> details. Registration: Activator = IActionInvokerProvider[]
> (DelegateActivator), Services =
> [System.Collections.Generic.IEnumerable`1[[Microsoft.AspNetCore.Mvc.Abstractions.IActionInvokerProvider,
> Microsoft.AspNetCore.Mvc.Abstractions, Version=2.2.0.0,
> Culture=neutral, PublicKeyToken=adb9793829ddae60]]], Lifetime =
> Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership
> = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details.
> Registration: Activator = ControllerActionInvokerProvider
> (ReflectionActivator), Services =
> [Microsoft.AspNetCore.Mvc.Abstractions.IActionInvokerProvider],
> Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None,
> Ownership = OwnedByLifetimeScope ---> An error occurred during the
> activation of a particular registration. See the inner exception for
> details. Registration: Activator = ControllerActionInvokerCache
> (ReflectionActivator), Services =
> [Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvokerCache],
> Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared,
> Ownership = OwnedByLifetimeScope ---> An error occurred during the
> activation of a particular registration. See the inner exception for
> details. Registration: Activator =
> DefaultActionDescriptorCollectionProvider (ReflectionActivator),
> Services =
> [Microsoft.AspNetCore.Mvc.Infrastructure.IActionDescriptorCollectionProvider],
> Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared,
> Ownership = OwnedByLifetimeScope ---> An exception was thrown while
> invoking the constructor 'Void
> .ctor(System.Collections.Generic.IEnumerable`1[Microsoft.AspNetCore.Mvc.Abstractions.IActionDescriptorProvider],
> System.Collections.Generic.IEnumerable`1[Microsoft.AspNetCore.Mvc.Infrastructure.IActionDescriptorChangeProvider])'
> on type 'DefaultActionDescriptorCollectionProvider'. ---> The
> configured user limit (128) on the number of inotify instances has
> been reached. (See inner exception for details.) (See inner exception
> for details.) (See inner exception for details.) (See inner exception
> for details.) (See inner exception for details.) (See inner exception
> for details.) (See inner exception for details.)   ---->
> Autofac.Core.DependencyResolutionException : An error occurred during
> the activation of a particular registration. See the inner exception
> for details. Registration: Activator = ActionInvokerFactory
> (ReflectionActivator), Services =
> [Microsoft.AspNetCore.Mvc.Infrastructure.IActionInvokerFactory],
> Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared,
> Ownership = OwnedByLifetimeScope ---> An error occurred during the
> activation of a particular registration. See the inner exception for
> details. Registration: Activator = IActionInvokerProvider[]
> (DelegateActivator), Services =
> [System.Collections.Generic.IEnumerable`1[[Microsoft.AspNetCore.Mvc.Abstractions.IActionInvokerProvider,
> Microsoft.AspNetCore.Mvc.Abstractions, Version=2.2.0.0,
> Culture=neutral, PublicKeyToken=adb9793829ddae60]]], Lifetime =
> Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership
> = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details.
> Registration: Activator = ControllerActionInvokerProvider
> (ReflectionActivator), Services =
> [Microsoft.AspNetCore.Mvc.Abstractions.IActionInvokerProvider],
> Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None,
> Ownership = OwnedByLifetimeScope ---> An error occurred during the
> activation of a particular registration. See the inner exception for
> details. Registration: Activator = ControllerActionInvokerCache
> (ReflectionActivator), Services =
> [Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvokerCache],
> Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared,
> Ownership = OwnedByLifetimeScope ---> An error occurred during the
> activation of a particular registration. See the inner exception for
> details. Registration: Activator =
> DefaultActionDescriptorCollectionProvider (ReflectionActivator),
> Services =
> [Microsoft.AspNetCore.Mvc.Infrastructure.IActionDescriptorCollectionProvider],
> Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared,
> Ownership = OwnedByLifetimeScope ---> An exception was thrown while
> invoking the constructor 'Void
> .ctor(System.Collections.Generic.IEnumerable`1[Microsoft.AspNetCore.Mvc.Abstractions.IActionDescriptorProvider],
> System.Collections.Generic.IEnumerable`1[Microsoft.AspNetCore.Mvc.Infrastructure.IActionDescriptorChangeProvider])'
> on type 'DefaultActionDescriptorCollectionProvider'. ---> The
> configured user limit (128) on the number of inotify instances has
> been reached. (See inner exception for details.) (See inner exception
> for details.) (See inner exception for details.) (See inner exception
> for details.) (See inner exception for details.) (See inner exception
> for details.)   ----> Autofac.Core.DependencyResolutionException : An
> error occurred during the activation of a particular registration. See
> the inner exception for details. Registration: Activator =
> IActionInvokerProvider[] (DelegateActivator), Services =
> [System.Collections.Generic.IEnumerable`1[[Microsoft.AspNetCore.Mvc.Abstractions.IActionInvokerProvider,
> Microsoft.AspNetCore.Mvc.Abstractions, Version=2.2.0.0,
> Culture=neutral, PublicKeyToken=adb9793829ddae60]]], Lifetime =
> Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership
> = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details.
> Registration: Activator = ControllerActionInvokerProvider
> (ReflectionActivator), Services =
> [Microsoft.AspNetCore.Mvc.Abstractions.IActionInvokerProvider],
> Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None,
> Ownership = OwnedByLifetimeScope ---> An error occurred during the
> activation of a particular registration. See the inner exception for
> details. Registration: Activator = ControllerActionInvokerCache
> (ReflectionActivator), Services =
> [Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvokerCache],
> Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared,
> Ownership = OwnedByLifetimeScope ---> An error occurred during the
> activation of a particular registration. See the inner exception for
> details. Registration: Activator =
> DefaultActionDescriptorCollectionProvider (ReflectionActivator),
> Services =
> [Microsoft.AspNetCore.Mvc.Infrastructure.IActionDescriptorCollectionProvider],
> Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared,
> Ownership = OwnedByLifetimeScope ---> An exception was thrown while
> invoking the constructor 'Void
> .ctor(System.Collections.Generic.IEnumerable`1[Microsoft.AspNetCore.Mvc.Abstractions.IActionDescriptorProvider],
> System.Collections.Generic.IEnumerable`1[Microsoft.AspNetCore.Mvc.Infrastructure.IActionDescriptorChangeProvider])'
> on type 'DefaultActionDescriptorCollectionProvider'. ---> The
> configured user limit (128) on the number of inotify instances has
> been reached. (See inner exception for details.) (See inner exception
> for details.) (See inner exception for details.) (See inner exception
> for details.) (See inner exception for details.)   ---->
> Autofac.Core.DependencyResolutionException : An error occurred during
> the activation of a particular registration. See the inner exception
> for details. Registration: Activator = ControllerActionInvokerProvider
> (ReflectionActivator), Services =
> [Microsoft.AspNetCore.Mvc.Abstractions.IActionInvokerProvider],
> Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None,
> Ownership = OwnedByLifetimeScope ---> An error occurred during the
> activation of a particular registration. See the inner exception for
> details. Registration: Activator = ControllerActionInvokerCache
> (ReflectionActivator), Services =
> [Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvokerCache],
> Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared,
> Ownership = OwnedByLifetimeScope ---> An error occurred during the
> activation of a particular registration. See the inner exception for
> details. Registration: Activator =
> DefaultActionDescriptorCollectionProvider (ReflectionActivator),
> Services =
> [Microsoft.AspNetCore.Mvc.Infrastructure.IActionDescriptorCollectionProvider],
> Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared,
> Ownership = OwnedByLifetimeScope ---> An exception was thrown while
> invoking the constructor 'Void
> .ctor(System.Collections.Generic.IEnumerable`1[Microsoft.AspNetCore.Mvc.Abstractions.IActionDescriptorProvider],
> System.Collections.Generic.IEnumerable`1[Microsoft.AspNetCore.Mvc.Infrastructure.IActionDescriptorChangeProvider])'
> on type 'DefaultActionDescriptorCollectionProvider'. ---> The
> configured user limit (128) on the number of inotify instances has
> been reached. (See inner exception for details.) (See inner exception
> for details.) (See inner exception for details.) (See inner exception
> for details.)   ----> Autofac.Core.DependencyResolutionException : An
> error occurred during the activation of a particular registration. See
> the inner exception for details. Registration: Activator =
> ControllerActionInvokerCache (ReflectionActivator), Services =
> [Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvokerCache],
> Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared,
> Ownership = OwnedByLifetimeScope ---> An error occurred during the
> activation of a particular registration. See the inner exception for
> details. Registration: Activator =
> DefaultActionDescriptorCollectionProvider (ReflectionActivator),
> Services =
> [Microsoft.AspNetCore.Mvc.Infrastructure.IActionDescriptorCollectionProvider],
> Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared,
> Ownership = OwnedByLifetimeScope ---> An exception was thrown while
> invoking the constructor 'Void
> .ctor(System.Collections.Generic.IEnumerable`1[Microsoft.AspNetCore.Mvc.Abstractions.IActionDescriptorProvider],
> System.Collections.Generic.IEnumerable`1[Microsoft.AspNetCore.Mvc.Infrastructure.IActionDescriptorChangeProvider])'
> on type 'DefaultActionDescriptorCollectionProvider'. ---> The
> configured user limit (128) on the number of inotify instances has
> been reached. (See inner exception for details.) (See inner exception
> for details.) (See inner exception for details.)   ---->
> Autofac.Core.DependencyResolutionException : An error occurred during
> the activation of a particular registration. See the inner exception
> for details. Registration: Activator =
> DefaultActionDescriptorCollectionProvider (ReflectionActivator),
> Services =
> [Microsoft.AspNetCore.Mvc.Infrastructure.IActionDescriptorCollectionProvider],
> Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared,
> Ownership = OwnedByLifetimeScope ---> An exception was thrown while
> invoking the constructor 'Void
> .ctor(System.Collections.Generic.IEnumerable`1[Microsoft.AspNetCore.Mvc.Abstractions.IActionDescriptorProvider],
> System.Collections.Generic.IEnumerable`1[Microsoft.AspNetCore.Mvc.Infrastructure.IActionDescriptorChangeProvider])'
> on type 'DefaultActionDescriptorCollectionProvider'. ---> The
> configured user limit (128) on the number of inotify instances has
> been reached. (See inner exception for details.) (See inner exception
> for details.)   ----> Autofac.Core.DependencyResolutionException : An
> exception was thrown while invoking the constructor 'Void
> .ctor(System.Collections.Generic.IEnumerable`1[Microsoft.AspNetCore.Mvc.Abstractions.IActionDescriptorProvider],
> System.Collections.Generic.IEnumerable`1[Microsoft.AspNetCore.Mvc.Infrastructure.IActionDescriptorChangeProvider])'
> on type 'DefaultActionDescriptorCollectionProvider'. ---> The
> configured user limit (128) on the number of inotify instances has
> been reached. (See inner exception for details.)   ---->
> System.IO.IOException : The configured user limit (128) on the number
> of inotify instances has been reached.

I had a look into the similar post

Error while reading json file in dotnet core "the configured user limit (128) on the number of inotify instances has been reached"

but I am not using JSON file in my Startup method. Just wondering what's going wrong.

ArunPratap
  • 4,816
  • 7
  • 25
  • 43
Jaydeep
  • 265
  • 5
  • 18
  • Have you looked at the actual answer of that post? Because I think it _will_ help. "You have to make sure, `var configuration = builder.Build()` is only called once in your application and store it in a place where you can access it" Also, please limit your post to only hold relevant information. Preferably only once. – rickvdbosch Feb 12 '19 at 09:00
  • this exception occurs because of dependency injection. my assumption your registering the wrong scope .Please look at this two link to understand the issue – Jagadeesh Govindaraj Feb 12 '19 at 09:06
  • https://github.com/autofac/Autofac/issues/809 – Jagadeesh Govindaraj Feb 12 '19 at 09:06
  • https://github.com/dotnet-architecture/eShopOnContainers/issues/277 – Jagadeesh Govindaraj Feb 12 '19 at 09:06
  • Hello @rickvdbosch yes the builder.build() has been called only once (It's inside Main method of Startup class) – Jaydeep Feb 12 '19 at 09:10
  • Hi @Jagadeesh Govindaraj, I think yes my regestartion is proper and it works fine all the time. I just get this error few times while performing test case execution as part of CI but when I re-run, it passes successfully. – Jaydeep Feb 12 '19 at 09:11
  • @Jaydeep.Ok Then crate issue in core repo with minimal reproduction step. also, update the question with minimal codes lines.so only others will understand the issue – Jagadeesh Govindaraj Feb 12 '19 at 09:15
  • Yes I have raised there but didn't get much help. I just want to highlight that I am using log4net, could it have any impact? https://github.com/aspnet/AspNetCore/issues/7531 – Jaydeep Feb 20 '19 at 14:36

0 Answers0