Hi,
I recently updated my app as follows: Abp 0.12 -> 1.2.1 Apb.Zero 0.12 -> 1.2.1 AspNet Zero 1.12.2 -> 3.0
All using the non-Core, SPA, Angular 1 versions.
Everything is working well except one place where I am inserting some records in an application service method. This method inserts a header record, gets the id and then inserts some child records. I'm using Async repository methods. The header record insert works normally and returns an id but the system hangs when trying to insert the child record and eventually times-out. This was working fine when using the earlier versions of the templates. I can't see any breaking change that would have caused this. Can you help?
The exception is "Execution Timeout Expired", "The wait operation timed out"
Stack trace:
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.<UpdateAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Data.Entity.Core.Objects.ObjectContext.<ExecuteInTransactionAsync>d__3d1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Data.Entity.Core.Objects.ObjectContext.<SaveChangesToStoreAsync>d__39.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<ExecuteAsyncImplementation>d__9
1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Data.Entity.Core.Objects.ObjectContext.<SaveChangesInternalAsync>d__31.MoveNext()
Thanks.
10 Answer(s)
-
0
Log extract is below:
ERROR 2017-01-27 18:06:09,742 [87 ] nHandling.AbpApiExceptionFilterAttribute - An error occurred while updating the entries. See the inner exception for details. System.Data.Entity.Infrastructure.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.Entity.Core.UpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.SqlClient.SqlException: Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception: The wait operation timed out --- End of inner exception stack trace --- at System.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__174_0(Task`1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.<ExecuteAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.<UpdateAsync>d__0.MoveNext() --- End of inner exception stack trace --- at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.<UpdateAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Data.Entity.Core.Objects.ObjectContext.<ExecuteInTransactionAsync>d__3d`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Data.Entity.Core.Objects.ObjectContext.<SaveChangesToStoreAsync>d__39.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<ExecuteAsyncImplementation>d__9`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Data.Entity.Core.Objects.ObjectContext.<SaveChangesInternalAsync>d__31.MoveNext() --- End of inner exception stack trace --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.EntityFramework.AbpDbContext.<SaveChangesAsync>d__42.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\AbpDbContext.cs:line 214 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.EntityFramework.Repositories.EfRepositoryBase`3.<InsertAndGetIdAsync>d__16.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Repositories\EfRepositoryBaseOfTEntityAndTPrimaryKey.cs:line 119 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinallyAndGetResult>d__5`1.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:line 120 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Cybertron.Sched.DomainModels.Text.TextValueManager.<CreateTextDateHeader>d__13.MoveNext() in G:\Users\gconey\Documents\Development\cybertron.sched\Cybertron.Sched.Core\DomainModels\Text\TextValueManager.cs:line 162 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Cybertron.Sched.DomainModels.Text.TextValueManager.<CreateInitialTextValue>d__8.MoveNext() in G:\Users\gconey\Documents\Development\cybertron.sched\Cybertron.Sched.Core\DomainModels\Text\TextValueManager.cs:line 102 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Cybertron.Sched.DomainModels.Base.Manager.DomainManagerBaseWithText`1.<CreateText>d__5.MoveNext() in G:\Users\gconey\Documents\Development\cybertron.sched\Cybertron.Sched.Core\DomainModels\Base\Manager\DomainManagerBaseWithText.cs:line 45 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Cybertron.Sched.DomainModels.Base.Manager.DomainManagerBaseWithText`1.<CreateAsync>d__3.MoveNext() in G:\Users\gconey\Documents\Development\cybertron.sched\Cybertron.Sched.Core\DomainModels\Base\Manager\DomainManagerBaseWithText.cs:line 32 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinally>d__1.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:line 40 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Cybertron.Sched.DomainServices.Geographical.Country.CountryAppService.<CreateCountryAsync>d__8.MoveNext() in G:\Users\gconey\Documents\Development\cybertron.sched\Cybertron.Sched.Application\DomainServices\Geographical\Country\CountryAppService.cs:line 138 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Cybertron.Sched.DomainServices.Geographical.Country.CountryAppService.<CreateOrUpdateCountry>d__6.MoveNext() in G:\Users\gconey\Documents\Development\cybertron.sched\Cybertron.Sched.Application\DomainServices\Geographical\Country\CountryAppService.cs:line 123 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinally>d__1.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:line 40 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithFinally>d__0.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:line 20 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.WebApi.Uow.AbpApiUowFilter.<ExecuteActionFilterAsync>d__5.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp.Web.Api\WebApi\Uow\AbpApiUowFilter.cs:line 40 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.WebApi.Validation.AbpApiValidationFilter.<ExecuteActionFilterAsync>d__5.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp.Web.Api\WebApi\Validation\AbpApiValidationFilter.cs:line 40 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.WebApi.Auditing.AbpApiAuditFilter.<ExecuteActionFilterAsync>d__4.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp.Web.Api\WebApi\Auditing\AbpApiAuditFilter.cs:line 30 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.WebApi.Security.AntiForgery.AbpAntiForgeryApiFilter.<ExecuteAuthorizationFilterAsync>d__10.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp.Web.Api\WebApi\Security\AntiForgery\AbpAntiForgeryApiFilter.cs:line 59 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.WebApi.Authorization.AbpApiAuthorizeFilter.<ExecuteAuthorizationFilterAsync>d__7.MoveNext() in D:\Halil\Github\aspnetboilerplate\src\Abp.Web.Api\WebApi\Authorization\AbpApiAuthorizeFilter.cs:line 63 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.AuthenticationFilterResult.<ExecuteAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()
-
0
Hi,
Do you use single database ? And which version of ABP do you use in your project ?
Can you also share sample code for this.
Thanks.
-
0
Hi,
I recently updated my system as follows: Abp 0.12 -> 1.2.1 Apb.Zero 0.12 -> 1.2.1 AspNet Zero 1.12.2 -> 3.0
The code worked fine before these updates. I use a single database at the moment.
I have changed the code and managed to get it working. Previously I was creating the parent record and doing InsertAndGetIdAsync, then creating each child record, setting the parent id on each and doing InsertAsync on the child records. Now I just create the parent, add the children and call InsertAndGetIdAsync on the parent and this inserts the parent and its children in one call. I hadn't realised EF would do this. But I don't understand why the above updates to Abp, etc broke the old way I was doing this. So I'd still like to understand why the above updates (and no other changes to my code) resulted in this issue.
Regards, George
-
0
Hi,
There was a bug and fixed in ABP v1.2.2 <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1783">https://github.com/aspnetboilerplate/as ... ssues/1783</a>. Can you upgrade ABP if possible and see if that works.
Because, your scenario is a common usage and it should work as expected.
-
0
I updated to Abp 1.2.2 which didn't help. I then updated to Abp 1.3.1 and the problem is still happening.
I've written a simple test method and am calling this at the App Service layer. It hangs and times-out at SaveChanges.
public async Task TestInsert() { var attributeHeader = new AttributeHeader(); attributeHeader.Id = await _attributeHeaderRepository.InsertAndGetIdAsync(attributeHeader); var attributeValue = new AttributeValue() { AttributeHeaderId = attributeHeader.Id, AttributeTypeId = 124, Value = "test" }; await _attributeValueRepository.InsertAsync(attributeValue); _unitOfWorkManager.Current.SaveChanges(); }
If I change this to the following it works (but it should work both ways):
public async Task TestInsert1() { var attributeHeader = new AttributeHeader(); var attributeValue = new AttributeValue() { AttributeTypeId = 124, Value = "test" }; attributeHeader.AttributeValues = new List<AttributeValue> { attributeValue }; attributeHeader.Id = await _attributeHeaderRepository.InsertAndGetIdAsync(attributeHeader); _unitOfWorkManager.Current.SaveChanges(); }
-
0
You are ringht.
Can you create an issue on ABP repository ? <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues">https://github.com/aspnetboilerplate/as ... ate/issues</a>
-
0
Hi,
I Couldn't repeat the problem in ABP repository, can you share your project with <a href="mailto:[email protected]">[email protected]</a> ? This way we can find the solution faster.
Thanks.
-
0
Ok, will do. I don't know why you can't reproduce this issue. It's odd as I can reproduce it easily.
I tried a few more things:
Updated to Abp 1.4.1 & Abp.Zero 1.4.0 - No change. Problem still occurs.
Tried with a different pair of parent child tables - the problem still occurred.
Put the code in a non-transnational uow. This then worked (but this isn't a solution). This indicates the problem is with transaction handling as I suspected. i.e. this works:
public async Task TestInsert() { using (var unitOfWork = _unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.Suppress)) { var attributeHeader = new AttributeHeader(); await _attributeHeaderRepository.InsertAndGetIdAsync(attributeHeader); var attributeValue = new AttributeValue() { AttributeHeaderId = attributeHeader.Id, AttributeTypeId = 124, AttributeType = null, Value = "test" }; await _attributeValueRepository.InsertAsync(attributeValue); //_unitOfWorkManager.Current.SaveChanges(); unitOfWork.Complete(); } }
-
0
Hi,
Thanks @gconey for sharing the project. It helped to understand the cause of the problem. The problem was related to wrong nuget package update. Updating to v1.4.1 solved the issue.