- ABP Framework version: v5.3.2
- UI type: MVC Razor pages
- DB provider: EF Core with PostgreSQL
- Tiered (MVC) or Identity Server Separated (Angular): MVC
- Exception message and stack trace:
- Steps to reproduce the issue:"
Recently, we have upgraded to abp.io 5.3.2 and found that ITenantAppService CreateAsync is broken. Earlier with 5.2.1, it would create database and apply migration successfully.
did you change its behavior ? if yes, How do I accomplish the same now?
Regards, Pravin Raijade.
Dear Support,
**Its little urgent. appreciate your quick turnaround. ** Regards, Pravin Raijade.
17 Answer(s)
-
0
Hi There,
I can confirm I'm having the same issue.
ABP Ver 5.3.2 Angular UI SQL Server + EF Core
A database time-out occurs causing the tenant to fail to create. This error does not bubble up to the UI, and the the UI returns to the tenant list showing the entry from SAASTenants table as if the tenant created. Here is a log of the error.
2022-07-16 21:48:44.907 +01:00 [ERR] Failed executing DbCommand (30,045ms) [Parameters=[@__ef_filter__p_0='?' (DbType = Boolean), @__id_0='?' (DbType = Guid)], CommandType='"Text"', CommandTimeout='30'] SELECT TOP(1) [s].[Id], [s].[ActivationEndDate], [s].[ActivationState], [s].[ConcurrencyStamp], [s].[CreationTime], [s].[CreatorId], [s].[DeleterId], [s].[DeletionTime], [s].[EditionEndDateUtc], [s].[EditionId], [s].[ExtraProperties], [s].[IsDeleted], [s].[LastModificationTime], [s].[LastModifierId], [s].[Name] FROM [SaasTenants] AS [s] WHERE ((@__ef_filter__p_0 = CAST(1 AS bit)) OR ([s].[IsDeleted] = CAST(0 AS bit))) AND ([s].[Id] = @__id_0) ORDER BY [s].[Id] 2022-07-16 21:48:44.910 +01:00 [ERR] An exception occurred while iterating over the results of a query for context type 'CloudBiz.Stockist.EntityFrameworkCore.StockistDbContext'. Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (258): Unknown error: 258 at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__188_0(Task`1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() 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 Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync() ClientConnectionId:ec2d6372-8566-42e9-be6f-a84594b17dbd Error Number:-2,State:0,Class:11 Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (258): Unknown error: 258 at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__188_0(Task`1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() 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 Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken) at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository`3.FindAsync(TKey id, Boolean includeDetails, 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) ClientConnectionId:ec2d6372-8566-42e9-be6f-a84594b17dbd Error Number:-2,State:0,Class:11 2022-07-16 21:48:44.911 +01:00 [ERR] Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (258): Unknown error: 258 at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__188_0(Task`1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() 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 Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken) at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository`3.FindAsync(TKey id, Boolean includeDetails, 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 Volo.Saas.Tenants.TenantStore.GetCacheItemAsync(Nullable`1 id, String name) at Volo.Saas.Tenants.TenantStore.FindAsync(Guid id) at CloudBiz.Stockist.Data.StockistTenantDatabaseMigrationHandler.MigrateAndSeedForTenantAsync(Guid tenantId, String adminEmail, String adminPassword) in /Users/ashjackson/Git/CloudBiz/Stockist/aspnet-core/src/CloudBiz.Stockist.Domain/Data/StockistTenantDatabaseMigrationHandler.cs:line 99 ClientConnectionId:ec2d6372-8566-42e9-be6f-a84594b17dbd Error Number:-2,State:0,Class:11 2022-07-16 21:48:44.911 +01:00 [ERR] ---------- Exception Data ---------- HelpLink.ProdName = Microsoft SQL Server HelpLink.ProdVer = 15.00.4236 HelpLink.EvtSrc = MSSQLServer HelpLink.EvtID = -2 HelpLink.BaseHelpUrl = https://go.microsoft.com/fwlink HelpLink.LinkId = 20476`
Steps to reproduce:
- Generate empty application template solution.
- Run & Add New Tenant from the SaaS > Tenants menu.
Kind Regards, AJ.
-
0
Hi There, Some further info:
The timeout occurs at this line
var tenantConfiguration = await _tenantStore.FindAsync(tenantId);
of ProjectNameTenantDatabaseMigrationHandler.MigrateAndSeedForTenantAsync method.
The timeout suggests that the transaction for inserting the tenant has not completed when the abp.multi_tenancy.tenant.created event is raised.
AJ.
-
0
Hi Support,
any updates on this issue#3434 ?
"ITenantAppService CreateAsync method Not creating database and applying migration. #3434"
Regards, Pravin Raijade.
-
0
hi @ash.jackson
Can you check this?
https://support.abp.io/QA/Questions/1915/Timeout-Error-Creating-a-Tenant
hi PravinRaijade
Can you try with a new template project?
-
0
Hi Support,
Huge code base has been developed and I cannot try creating new project from scratch and test it.
I am migrating as and when new version of ABP.IO is released.
Below line is not working, I mean it is not creating Table in PostgreSQL and not applying migrations which was working earlier. saasTenantDto = _tenantAppService.CreateAsync(createDto).Result;
Please suggest.
Regards, Pravin Raijade.
-
0
Below line is not working, I mean it is not creating Table in PostgreSQL and not applying migrations which was working earlier.
First, The correct code should use
await
var saasTenantDto = await _tenantAppService.CreateAsync(createDto);
Then there is a file that should exist in your project, It responsible to migrating the tenant database and seeding the initial data, Can you try to debug it?
-
0
Hi Support,
small correction, the right code line is as below
saasTenantDto = _tenantAppService.CreateAsync(createDto).Result;
so with ".Result", we don't require "await", right
Regarding Tenant Database migration hadler, where is it located, or should be located?
But, earlier everything was working fine. This issue is only after migrating to abp 5.3.2
Regards. Pravin Raijade.
-
0
Hi @maliming
Setting the requiresNew parameter to false in this line
using (var uow = _unitOfWorkManager.Begin(requiresNew: false, isTransactional: true))
as per #1386 solves the time-out issue for me.
Thank you for your assistance.
hi @ash.jackson
Can you check this?
https://support.abp.io/QA/Questions/1915/Timeout-Error-Creating-a-Tenant
hi PravinRaijade
Can you try with a new template project?
-
0
Dear Maliming,
My issue#3434 is still open.
ITenantAppService CreateAsync method Not creating database and applying migration. #3434
Kindly help.
Regards, Pravin Raijade.
-
0
-
0
Dear Support,
No my problem has not been resolved yet.
can we connect over Teams?
Regards, Pravin Raijade.
-
0
hi
Have you tried the steps I mentioned above?
-
0
Hi Maliming,
after below call, none of the break point in class "CargoServiceFrameworkTenantDatabaseMigrationHandler" is hitting.
SaasTenantDto saasTenantDto = await _tenantAppService.CreateAsync(createDto);
I am calling above Tenant Service in "OnPostAsync" of my CreateModal.
Regards, Pravin Raijade.
-
0
hi
Can you share a project with me? liming.ma@volosoft.com
-
0
hi
Can you share a project with me? liming.ma@volosoft.com
Hi Malinga, I have added you to gitlab repo and shared DB backup file in email. Please let me know once you get your copy. Regards, Pravin Raijade.
-
0
-
0