Open Closed

Volo.Abp.AbpInitializationException: An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor... #4707


User avatar
0
nqthaitn created

Hi, I am experiencing an issue where running all 226 unit tests results in an error. However, when I run approximately 50 test cases at a time, all of the tests pass. Although I am able to perform this task on my local machine, I have been unable to pass this on Bitbucket's CICD. Please help. Thanks.

  • ABP Framework version: v6.0.2
  • UI type: Angular
  • DB provider: MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
Volo.Abp.AbpInitializationException: An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor...

Volo.Abp.AbpInitializationException
An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module GoSquid.GoSquidTestBaseModule, GoSquid.TestBase, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: Command create failed: 24: Too many open files.. See the inner exception for details.
   at Volo.Abp.Modularity.ModuleManager.InitializeModules(ApplicationInitializationContext context)
   at Volo.Abp.AbpApplicationBase.InitializeModules()
   at Volo.Abp.Testing.AbpIntegratedTest`1..ctor()
   at GoSquid.GoSquidTestBase`1..ctor()
   at GoSquid.GoSquidApplicationTestBase..ctor()
   at GoSquid.GuildInvitations.GuildInvitationsAppServiceTests..ctor() in /Users/thaingo/Sources/GoSquid/gosquid-suite/aspnet-core/test/GoSquid.Application.Tests/GuildInvitations/GuildInvitationApplicationTests.cs:line 16
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)

MongoDB.Driver.MongoCommandException
Command create failed: 24: Too many open files.
   at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1.ProcessResponse(ConnectionId connectionId, CommandMessage responseMessage)
   at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1.Execute(IConnection connection, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.WireProtocol.CommandWireProtocol`1.Execute(IConnection connection, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Servers.Server.ServerChannel.ExecuteProtocol[TResult](IWireProtocol`1 protocol, ICoreSession session, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Servers.Server.ServerChannel.Command[TResult](ICoreSession session, ReadPreference readPreference, DatabaseNamespace databaseNamespace, BsonDocument command, IEnumerable`1 commandPayloads, IElementNameValidator commandValidator, BsonDocument additionalOptions, Action`1 postWriteAction, CommandResponseHandling responseHandling, IBsonSerializer`1 resultSerializer, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.CommandOperationBase`1.ExecuteProtocol(IChannelHandle channel, ICoreSessionHandle session, ReadPreference readPreference, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.CommandOperationBase`1.ExecuteProtocol(IChannelSource channelSource, ICoreSessionHandle session, ReadPreference readPreference, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.WriteCommandOperation`1.Execute(IWriteBinding binding, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.CreateCollectionOperation.Execute(IWriteBinding binding, CancellationToken cancellationToken)
   at MongoDB.Driver.OperationExecutor.ExecuteWriteOperation[TResult](IWriteBinding binding, IWriteOperation`1 operation, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoDatabaseImpl.ExecuteWriteOperation[T](IClientSessionHandle session, IWriteOperation`1 operation, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoDatabaseImpl.CreateCollection(IClientSessionHandle session, String name, CreateCollectionOptions options, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoDatabaseImpl.UsingImplicitSession(Action`1 func, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoDatabaseImpl.CreateCollection(String name, CreateCollectionOptions options, CancellationToken cancellationToken)
   at Volo.Abp.MongoDB.MongoModelBuilder.CreateCollectionIfNotExists(AbpMongoDbContext dbContext, String collectionName)
   at Volo.Abp.MongoDB.MongoModelBuilder.Build(AbpMongoDbContext dbContext)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Volo.Abp.MongoDB.AbpMongoDbContext.GetEntityModel[TEntity]()
   at Volo.Abp.MongoDB.AbpMongoDbContext.GetCollectionName[T]()
   at Volo.Abp.MongoDB.AbpMongoDbContext.Collection[T]()
   at Volo.Abp.Domain.Repositories.MongoDB.MongoDbRepository`2.InsertAsync(TEntity entity, Boolean autoSave, CancellationToken cancellationToken)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at GoSquid.StatisticMonthlies.StatisticMonthliesDataSeedContributor.SeedAsync(DataSeedContext context) in /Users/thaingo/Sources/GoSquid/gosquid-suite/aspnet-core/test/GoSquid.TestBase/StatisticMonthlies/StatisticMonthliesDataSeedContributor.cs:line 30
   at Volo.Abp.Data.DataSeeder.SeedAsync(DataSeedContext context)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync()
   at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at GoSquid.GoSquidTestBaseModule.<>c__DisplayClass2_0.<<SeedTestData>b__0>d.MoveNext() in /Users/thaingo/Sources/GoSquid/gosquid-suite/aspnet-core/test/GoSquid.TestBase/GoSquidTestBaseModule.cs:line 41
--- End of stack trace from previous location ---
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException(Task task)
   at Nito.AsyncEx.AsyncContext.Run(Func`1 action)
   at GoSquid.GoSquidTestBaseModule.SeedTestData(ApplicationInitializationContext context) in /Users/thaingo/Sources/GoSquid/gosquid-suite/aspnet-core/test/GoSquid.TestBase/GoSquidTestBaseModule.cs:line 37
   at GoSquid.GoSquidTestBaseModule.OnApplicationInitialization(ApplicationInitializationContext context) in /Users/thaingo/Sources/GoSquid/gosquid-suite/aspnet-core/test/GoSquid.TestBase/GoSquidTestBaseModule.cs:line 32
   at Volo.Abp.Modularity.ModuleManager.InitializeModules(ApplicationInitializationContext context)
  • Steps to reproduce the issue:" Run Unit Tests
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

9 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    What is your OS?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    nqthaitn created

    hi

    What is your OS?

    Hi, I'm using MacBook Pro M1 ( macOS 13.2.1 (22D68))

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can try increase limit of your macOS

    https://www.mongodb.com/docs/manual/administration/production-checklist-operations/#operating-system-configuration https://www.mongodb.com/docs/manual/reference/ulimit/#recommended-ulimit-settings

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    nqthaitn created

    hi

    You can try increase limit of your macOS

    https://www.mongodb.com/docs/manual/administration/production-checklist-operations/#operating-system-configuration https://www.mongodb.com/docs/manual/reference/ulimit/#recommended-ulimit-settings

    It appears that the defaults for open files in the docker container are already way larger than the recommended settings

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Is there any logs in MongoDB(docker) when the unit test fails.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    nqthaitn created

    hi

    Is there any logs in MongoDB(docker) when the unit test fails.

    hmm, I think we are misunderstanding the problem, ABP framework is using mongo2go (in-memory) for integration tests, that is not related to MongoDb running on docker at all. right?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Yes, What's ulimit -a command result on your macbook?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    nqthaitn created

    Yes, What's ulimit -a command result on your macbook?

    I already set to 64000, restart the macOs , -> still error

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi You can try asking Mongo2Go, I have no other ideas. https://github.com/Mongo2Go/Mongo2Go/issues

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 05, 2026, 11:32
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.