Activities of "cangunaydin"

Thank you @mahmut.

Hello again, you can find the project in this github repo. https://github.com/cangunaydin/abpConcurrencyIssue to produce the same error you have to do the followings.

1- Clone the project.

2- Go to aspnet-core\etc\docker

3- execute run-docker-sideapps.ps1 this will create the redis and postgres(postgis) container.(stick to these images since appsettings has been configured according to those docker images and geolocation is involved)

4- Build project and run dbmigrator. This will seed a new tenant named "Tribulus" and one screen belongs to this tenant with id: "ad16f9e2-bf39-43cf-af69-47b7388ee9cd". You can check TenantDataSeeder class if you want.

5- abp install-libs inside AuthServer folder then Run Doohlink.AuthServer and Doohlink.HttpApi.Host project

6- Run angular app and get bearer token for Tribulus tenant with username: admin, password: 123qwe, note the bearer token and tenantid to somewhere, you will use them on step 8 7- Install Jmeter to do multiple http requests async. If you want you can use another tool but important part is you need bunch of async calls at the same time. https://jmeter.apache.org/download_jmeter.cgi Download zip file, unzip it then run jmeter.bat

8- After running the Jmeter, you need to open the TestJmeter.jmx file on the root folder of the project. This is a script that will do the call to the endpoint.

9- Change the bearer token and tenantid to what you got from step 6. You need to do that from Http Header Manager

10-Run the jmeter, it is gonna take 10 seconds, you can see if http requests are successful on treeview. Most of them will succeed around 5 of them will fail. you can look at the logs afterwards.

Hello @liangshiwei, is it okay if i share the original project? it is not a super complicated project i think you will understand.

  • ABP Framework version: v7.1.0
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:

System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct. at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Collections.Generic.Dictionary2.set_Item(TKey key, TValue value) at Volo.Abp.Uow.UnitOfWorkExtensions.GetOrAddItem[TValue](IUnitOfWork unitOfWork, String key, Func2 factory) at Volo.Abp.Caching.DistributedCache2.GetAsync(TCacheKey key, Nullable1 hideErrors, Boolean considerUow, CancellationToken token) at Volo.Saas.Tenants.TenantStore.GetCacheItemAsync(Nullable1 id, String name) at Volo.Saas.Tenants.TenantStore.FindAsync(Guid id) at Volo.Abp.MultiTenancy.MultiTenantConnectionStringResolver.FindTenantConfigurationAsync(Guid tenantId) at Volo.Abp.MultiTenancy.MultiTenantConnectionStringResolver.ResolveAsync(String connectionStringName) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.ResolveConnectionStringAsync(String connectionStringName) at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider1.GetDbContextAsync() at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository2.GetDbSetAsync() at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository2.GetQueryableAsync() at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository2.WithDetailsAsync() at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository3.FindAsync(TKey id, Boolean includeDetails, CancellationToken cancellationToken) at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository3.GetAsync(TKey id, Boolean includeDetails, CancellationToken cancellationToken) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Doohlink.CampaignManagement.Screens.ScreenAppService.GetAsync(Guid id) in C:\Development\Projects\Examples\Doohlink\aspnet-core\modules\Doohlink.CampaignManagement\src\Doohlink.CampaignManagement.Application\Screens\ScreenAppService.cs:line 22 at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, AbpAuditingOptions options, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope) at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at Doohlink.Screens.ScreenAppService.GetAsync(Guid id) in C:\Development\Projects\Examples\Doohlink\aspnet-core\src\Doohlink.Application\Screens\ScreenAppService.cs:line 23

Hello, I have an application which i created two different modules and from the main app i am calling application services of those modules async methods in parallel. sth like this.

 public async Task<ScreenDto> GetAsync(Guid id)
    {
        var inventory = _inventoryScreenAppService.GetAsync(id);
        var campaign = _campaignScreenAppService.GetAsync(id);
        await Task.WhenAll(inventory, campaign);

        var screenDto = new ScreenDto();
        ObjectMapper.Map(inventory.Result, screenDto);
        ObjectMapper.Map(campaign.Result, screenDto);

        return screenDto;
    }

not always but sometimes I am getting this exception on runtime. It is very straightforward what happens inside those 2 appservices.

Inventory ScreenAppService

   public async Task<ScreenDto> GetAsync(Guid id)
    {
        var screen = await _screenRepository.GetAsync(id);
        return ObjectMapper.Map<Screen, ScreenDto>(screen);
    }

Campaign ScreenAppService

 public async Task<ScreenDto> GetAsync(Guid id)
    {
        var screen = await _screenRepository.GetAsync(id);
        return ObjectMapper.Map<Screen, ScreenDto>(screen);
    }

two modules have different dbcontexts(2 seperate databases). and storing different information about screen. it seems it is the same method but they are in different namespaces and different properties they hold for screen and screendto.

Campaign ScreenDto

using System;
using System.Collections.Generic;
using Volo.Abp.Application.Dtos;

namespace Doohlink.CampaignManagement.Screens;

public class ScreenDto : EntityDto<Guid>
{
    public ResolutionDto Resolution { get; set; }

    public List<OpeningHoursDto> OpeningHours { get; set; }

    public List<double> Durations { get; set; }

    public List<string> MimeTypes { get; set; }
}

Inventory ScreenDto

using System;
using Volo.Abp.Application.Dtos;

namespace Doohlink.InventoryManagement.Screens;

public class ScreenDto : EntityDto<Guid>
{
    public string Name { get; set; }

    public string MacAddress { get; set; }

    public LocationDto Location { get; set; }
}

as I see from the exception it is trying to get the tenant and resolve the configuration

at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Collections.Generic.Dictionary2.set_Item(TKey key, TValue value) at Volo.Abp.Uow.UnitOfWorkExtensions.GetOrAddItem[TValue](IUnitOfWork unitOfWork, String key, Func2 factory) at Volo.Abp.Caching.DistributedCache2.GetAsync(TCacheKey key, Nullable1 hideErrors, Boolean considerUow, CancellationToken token) at Volo.Saas.Tenants.TenantStore.GetCacheItemAsync(Nullable1 id, String name) at Volo.Saas.Tenants.TenantStore.FindAsync(Guid id) at Volo.Abp.MultiTenancy.MultiTenantConnectionStringResolver.FindTenantConfigurationAsync(Guid tenantId)

it seems it is a concurrency issue while tenant has been fetched from the cache or db. Any suggestion to fix this issue?

Ps: I have tried to change the method in main app

 public async Task<ScreenDto> GetAsync(Guid id)
    {
        var inventory = _inventoryScreenAppService.GetAsync(id);
        var campaign = _campaignScreenAppService.GetAsync(id);
        await Task.WhenAll(inventory, campaign);

        var screenDto = new ScreenDto();
        ObjectMapper.Map(inventory.Result, screenDto);
        ObjectMapper.Map(campaign.Result, screenDto);

        return screenDto;
    }

to

 public async Task<ScreenDto> GetAsync(Guid id)
    {
        var inventory =await _inventoryScreenAppService.GetAsync(id);
        var campaign =await _campaignScreenAppService.GetAsync(id);
        

        var screenDto = new ScreenDto();
        ObjectMapper.Map(inventory, screenDto);
        ObjectMapper.Map(campaign, screenDto);

        return screenDto;
    }

it didn't fix the issue.

Hello again, thanks for pointing out the code now it is more clear. What i couldn't understand is if it is in the cache, it shouldn't give any error since it is gonna return it from the cache. Anyway i am gonna close this issue, thanks for your help @liangshiwei

I think i have found the solution but I couldn't understand why it behaves like it. I use docker container for postgres and redis. If I remove containers and images and compose it again, it writes to database. I still couldn't find where the data is persisted (from which section of the code).
I was checking ILocalizationResourceContributor implementations inside the source code, can not see any data persistency. Can you post the class or line where abp store the localization resources to db?

For my problem, I am suspicious that after some time probably i deleted the db manually and recreate it again through dbmigrator. Maybe resources stayed in the cache, but still didn't make sense why it couldn't find the resource if it is still in the cache. Cause endpoint should return to angular app if it was there.

I can share my project, but i don't think you could reproduce the issue since you are gonna create it from scratch.

Hello, Thanks for the reply. Is this image from "AbpLocalizationResources" Table. If it is, in my database it is empty. So I was wondering from where is this data seeded? Cause definitely it is not been stored in my database. And i use postgres instead of sql.

  • ABP Framework version: v7.1.0
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes

Hello, I am trying to understand how the localization works for the leptonx theme since i am getting the warning in my angular app 'Could not find localization source: LeptonX'

if i debug the app here you can see it tries to get the localization value from source LeptonX. But there is no such resource inside the source list.

What i wonder is, how does the angular leptonx module is taking the resource from the backend? If you create a solution from scratch with angular, it doesn't include the leptonx module inside HttpApi.Host project

shouldn't it include the localization resource so it can find it inside resources for angular app?

Hello @mahmut.gundogdu I think you are talking about one part of my question which is "building problem" right? I suppose this package "builder": "@angular-devkit/build-ng-packagr:build" is deprecated that's in your angular.json file. As i say on my second post i fixed it by changing the package.

Also I am having trouble with npm install could you be able to install the packages with npm instead of yarn? if you are what is the node version and npm version can you share it?

And for my last post which is related with vscode intellisense. If i change my component to standalone component the error disappears. Which is kind of weird. I couldn't find why? But it doesn't solve my problem cause then i need to provide lots of services, that i use inside the component. Anything that i could try to fix that? it builds and i do not get any error when i compile but i wanted to ask if you face any problem like that?

my node version is 18.15.0 and npm version 9.6.1

Any findings on this one? I am having difficulties with modular structure in angular. It can be nice to have an example on the angular side about how to build custom abp angular module. If I use yarn only and i do not look at the vscode syntax errors i can build my library but it is little annoying. So more questions about this subject are :

  • How you should store your node modules should it be under the main project when you are building modular app? As you can see in the image all the packages are under node_modules folder of the main app. Libraries under "projects" folder are importing their modules from the main app folder. Is this a good practice? I am trying to import abp file-management module inside creative-management module, and the dependency @volo/abp.ng.file-management is inside main app in this case.

When i do this vscode underlines an error for the components that i used inside my library but it still builds. I have tried many things to fix the problem like reinstalling angular language service but it doesn't work. Do you have any idea why it happens? as you can see here it is already imported in my module

i would love to hear any suggestion about this. thank you.

Showing 71 to 80 of 96 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11