Open Closed

Deadlock hang InitializeApplicationAsync when Debugging #9708


User avatar
0
brauerj@gc.adventist.org created

I'm regularly getting a deadlock based hang when starting a debug session (from visual studio). I'm only getting this with some of my larger ABP Blazor-Server apps.

The Console App stops with showing the all of the "Loaded ABP modules." It just never seems to complete the initialization.

Here is the Task View from visual studio. That seems like it should point towards the issue.

Any suggestions on next steps? Often when I restart it will start correctly. The fact that it isn't consistent makes debugging very annoying!

Thanks,

Jonathan


10 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • Deadlocks during ABP application startup, especially in large Blazor Server apps, can be caused by blocking calls, improper async/await usage, or circular dependencies in module initialization. The "Loaded ABP modules" message indicates the deadlock occurs during or after module initialization.

    • Next steps for troubleshooting:

      1. Review all module initialization code for any synchronous blocking calls on async methods (e.g., .Result, .Wait()). These can easily cause deadlocks in ASP.NET Core and ABP's modular startup.
      2. Ensure all async methods are awaited properly and avoid mixing synchronous and asynchronous code in module configuration and initialization.
      3. Check for circular dependencies between modules or services, especially if using Autofac or custom dependency injection logic.
      4. Temporarily disable or comment out custom modules or third-party integrations to isolate the problematic module.
      5. Use Visual Studio's "Tasks" window (as shown in your screenshot) to identify which tasks are blocked and trace their call stacks for clues.
      6. If using background workers or hosted services, ensure they do not block the main thread during startup.
    • If the issue is intermittent, it may be related to race conditions or timing issues in module/service initialization.

    • For more details on ABP application startup and debugging internals, see:

      • https://abp.io/docs/latest/framework/fundamentals/application-startup
      • https://abp.io/support/questions/978/How-can-I-debug-in-the-source-code-of-ABP-framework

    Sources:

    • https://abp.io/docs/latest/framework/fundamentals/application-startup
    • https://abp.io/support/questions/978/How-can-I-debug-in-the-source-code-of-ABP-framework

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you disable the Hot Reload and try again? Additionally, updating VS to the latest version may also be helpful.

    Thanks.

  • User Avatar
    0
    brauerj@gc.adventist.org created

    Sorry how would Blazor development be worth it without hot reload? It's a periodic issue doesn't happen every time... I can try but it might be easier to just start pulling the application apart entirely. But again the periodic nature makes it difficult....

  • User Avatar
    0
    brauerj@gc.adventist.org created

    Same thing happens with my other ABP Blazor Server app.

    It again shows the same types of tasks blocked (completely unrelated application).

    I'm wondering if it could be because of some complex interdependencies between modular monolith DDD modules. Does LanguageManagementDomainModule try to use Autofac to create a Singleton Instance and somehow it tries to get instantiated from two sides? If so how would I track that down and prevent it?

    I see Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute() in the blocked stack...

  • User Avatar
    0
    brauerj@gc.adventist.org created

    It looks like I had some missing [DependesOn()] attributes for inter-modular dependencies. Adding those in to see if that helps.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can also try to disable these to see if it helps.

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        Configure<FeatureManagementOptions>(options =>
        {
            options.SaveStaticFeaturesToDatabase = false;
            options.IsDynamicFeatureStoreEnabled = false;
        });
        Configure<PermissionManagementOptions>(options =>
        {
            options.SaveStaticPermissionsToDatabase = false;
            options.IsDynamicPermissionStoreEnabled = false;
        });
    
        Configure<TextTemplateManagementOptions>(options =>
        {
            options.SaveStaticTemplatesToDatabase = false;
            options.IsDynamicTemplateStoreEnabled = false;
        });
    
        Configure<AbpExternalLocalizationOptions>(options =>
        {
            options.SaveToExternalStore = false;
        });
    }
    

    Thanks

  • User Avatar
    0
    roberto.fiocchi created

    Hi @maliming, sorry to ask, but can you explain what these options do? I'm always interested in understanding ABP services, since I don't use many of them, and I'd also like to find a way to disable anything I don't need to improve debugging and development.

    Thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Enabling them will create several threads to initialize or synchronize data after the application starts. You can try disabling them.

    From https://github.com/abpframework/abp/pull/13644

    Thanks

  • User Avatar
    0
    brauerj@gc.adventist.org created

    [brauerj@gc.adventist.org] said: It looks like I had some missing [DependesOn()] attributes for inter-modular dependencies. Adding those in to see if that helps.

    It looks like the missing [DependsOn] attributes were the issue on my side. Adding these has seemingly solved the issue for both applications.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Great

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.0.0-preview. Updated on September 01, 2025, 08:37