Open Closed

Issue After Many Locations and User Organization mapping #9941


User avatar
0
viswajwalith created

We are facing the issue during login process. when we have number of locations "AbpUserOrganizationUnits" (we have around 1500 Locations) and all of he locations is mapped to the users "AbpUserOrganizationUnits", The number of users are around 3000 this was working ok in our previous ABP 5 solution but after upgrading to Abp9 we found lot time it is taking top process the below code, around 3 minutes hence getting the timeout as well

In order top check this We have created a simple layered solution, and loaded with 2000 Locations. in this case we observed lo of time is taking at

As per our analysis we are suspecting on claims. This is very critial and makor concern.


39 Answer(s)
  • User Avatar
    0
    viswajwalith created

    [maliming] said: hi

    Can you test this commit?

    https://github.com/Exceego-Info-Labs-Pvt-Ltd/POC/commit/2626cb40fb32a5b9c8482609c587a59492132d49

    Thanks.

    WIth the change provided, able to complete the login process, but we are still trying to add OrganizationUnits to cliamns issue still persists. In this case how to add the OrganizationUnits to the claims?

    We yet to try this work around solution in Micro Service based solution, if so do we need to include the MyEfCoreIdentityUserRepository in identity service?

    Please advise.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    but we are still trying to add OrganizationUnits to cliamns issue still persists. I

    Can you add the code to https://github.com/Exceego-Info-Labs-Pvt-Ltd/POC project? So I can reproduce it.

    Thanks.

  • User Avatar
    0
    viswajwalith created

    [maliming] said: hi

    but we are still trying to add OrganizationUnits to cliamns issue still persists. I

    Can you add the code to https://github.com/Exceego-Info-Labs-Pvt-Ltd/POC project? So I can reproduce it.

    Thanks.

    I have checkin the code, it is just enabling the organizationUnits in claims. after this change the same issue poped up

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    This seems unavoidable because the current user has thousands of organizations, and EF Core's entity tracking needs to load and track all entities, which is why it's slow.

    For example, if you have 5,000 roles or logins in the future, you will still encounter this problem.

    So you can either prevent assigning too many organzation to a user or modify the Identity module code to avoid loading all navigation entities explicitly. Then, query all entities at once as needed and tell EF Core not to track them.

    https://abp.io/docs/latest/framework/architecture/domain-driven-design/repositories#read-only-repositories https://abp.io/docs/latest/framework/architecture/domain-driven-design/repositories#read-only-repositories-behavior-in-entity-framework-core

    Thanks.

  • User Avatar
    0
    viswajwalith created

    [maliming] said: hi

    This seems unavoidable because the current user has thousands of organizations, and EF Core's entity tracking needs to load and track all entities, which is why it's slow.

    For example, if you have 5,000 roles or logins in the future, you will still encounter this problem.

    So you can either prevent assigning too many organzation to a user or modify the Identity module code to avoid loading all navigation entities explicitly. Then, query all entities at once as needed and tell EF Core not to track them.

    https://abp.io/docs/latest/framework/architecture/domain-driven-design/repositories#read-only-repositories https://abp.io/docs/latest/framework/architecture/domain-driven-design/repositories#read-only-repositories-behavior-in-entity-framework-core

    Thanks.

    If we understand correctly you mean to say the issue is with EF while fetching and tracking the table with 5k + records and no issue with claims?

    I have added the noTracking but still no luck, same code is pushed to that code.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    here is my test code.

    https://github.com/Exceego-Info-Labs-Pvt-Ltd/POC/pull/1

    AsNoTracking:

  • User Avatar
    0
    viswajwalith created

    [maliming] said: hi

    Can you test this commit?

    https://github.com/Exceego-Info-Labs-Pvt-Ltd/POC/commit/2626cb40fb32a5b9c8482609c587a59492132d49

    Thanks.

    Thanks with this it worked, just would like to know is there any way to set the no tracking for all EF get methods by default at service level?

    For us one of the major issue is with _userManager.GetByIdAsyn , atleast share the respective code file to place that NoTracking

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    We need the entity tracking feature when we update an entity. see https://learn.microsoft.com/en-us/ef/core/change-tracking/

    You can try to disable it in MyEfCoreIdentityUserRepository.cs‎ when querying entities.

    The solution is:

    So you can either prevent assigning too many organzation to a user or modify the Identity module code to avoid loading all navigation entities explicitly. Then, query all entities at once as needed and tell EF Core not to track them.

    https://abp.io/docs/latest/framework/architecture/domain-driven-design/repositories#read-only-repositories https://abp.io/docs/latest/framework/architecture/domain-driven-design/repositories#read-only-repositories-behavior-in-entity-framework-core

  • User Avatar
    0
    viswajwalith created

    [maliming] said: hi

    We need the entity tracking feature when we update an entity. see https://learn.microsoft.com/en-us/ef/core/change-tracking/

    You can try to disable it in MyEfCoreIdentityUserRepository.cs‎ when querying entities.

    The solution is:

    So you can either prevent assigning too many organzation to a user or modify the Identity module code to avoid loading all navigation entities explicitly. Then, query all entities at once as needed and tell EF Core not to track them.

    https://abp.io/docs/latest/framework/architecture/domain-driven-design/repositories#read-only-repositories https://abp.io/docs/latest/framework/architecture/domain-driven-design/repositories#read-only-repositories-behavior-in-entity-framework-core

    Our solution is from ABP 5 which now upgraded to ABP 9, with the code you provided.

        return queryable
            .Include(x => x.Roles)
            .Include(x => x.Logins)
            .Include(x => x.Claims)
            .Include(x => x.Tokens)
            .Include(x => x.OrganizationUnits)
            .AsNoTracking();
    

    we are got getting the OrganizationUnitID which we have in AbpUsers table, how to handle this?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    we are got getting the OrganizationUnitID which we have in AbpUsers table, how to handle this?

    What do you mean? I don't understand.

    Thanks.

  • User Avatar
    0
    viswajwalith created

    [maliming] said: hi

    we are got getting the OrganizationUnitID which we have in AbpUsers table, how to handle this?

    What do you mean? I don't understand.

    Thanks.

    We have the Column "OrganizationUnidId in AbpUsersTable but when trying to fetch all user details with GetIdentityUser. OrganizationUnitId is not coming (this i in our old solution where we have implemneted the NoTracking logic in claims)

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    How did you added this column to identity user in your project? Object Extensions?

    Please share your code.

    Thanks

  • User Avatar
    0
    viswajwalith created

    hi We are facing an issue in the Organization Unit multi-select tree within the User Creation dialog.

    When we click Select All, the system starts selecting organization units but only some of them get selected. Others remain unselected, and the browser console shows multiple Uncaught RangeError: Maximum call stack size exceeded errors.

    The issue seems to occur due to the large number of organization units we have in the system around 1150, which causes deep recursive DOM updates or event handling loops.

    Please refer to the attached screenshot, showing both the UI and the console errors.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share a screenshot of When we click Select All?

    There is no Select All button in the user creation page.

    How many organizations in the page? are o 5K?

    Thanks.

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.1.0-preview. Updated on October 16, 2025, 11:22