You are right, I just replaced it by a try/catch block to avoid logging these exceptions.
@ismcagdas : yes, Abp 5.7 @alexanderpilhar : thanks, I could fix it by adding suggested code here : https://support.aspnetzero.com/QA/Questions/8611#answer-9291fbcd-73ae-e4e4-b75b-39f3b1da856d
hi @ismcagdas,
From my side, I'm using ABP5.5. I will give a try and give a feedback.
Hi,
I'm currently experiencing performance issues that might be due to signalr exceptions on Azure app service. I'm currently monitoring the app to find the issue. It can be linked to yours.
I have a lot of signalr issues mentioned in the logs due to connection lost, task canceled...
WARN Web.Chat.SignalR.ChatHub - System.Threading.Tasks.TaskCanceledException: A task was canceled.
Ahah, yes you are right ! This time, I don't have nuget packages to update.
I found others related issues https://github.com/dotnet/extensions/issues/2566 https://github.com/dotnet/aspnetcore/issues/20617
I applied a workarround by adding a reference to Microsoft.AspNetCore.AzureAppServicesIntegration but the issue is still here.
A fix is planned for next .net core version 3.1.4...
I will ask support to azure team and provide a workarround if find any
@ismcagdas,
I found this kind of lines in the logs that matches the CPU charge spikes :
FATAL 2020-05-07 11:53:28,813 [1 ] Microsoft.AspNetCore.Hosting.Diagnostics - Hosting startup assembly exception
System.InvalidOperationException: Startup assembly Microsoft.AspNetCore.AzureAppServices.HostingStartup failed to execute. See the inner exception for more details.
---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.AzureAppServices.HostingStartup, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'Microsoft.AspNetCore.AzureAppServices.HostingStartup, Culture=neutral, PublicKeyToken=null'
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly assemblyContext, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
I found a related issue on github here : https://github.com/dotnet/aspnetcore/issues/14547
Did you faced same issues ?
Hi @ismcagdas,
SignalR is being used from angular and xamarin apps. I can't just deactivate it. The problem is that it is really not predictable how CPU charge is evolving...and all logs are pointing to SignalR exception. But as you know, these SignalR exception logs are happening several times per day and without impacting CPU charge most of time. Therefore, I'm not sure if that is the cause...
Really, I don't how to fix this.
Tks for your feedback, @rajamannar.
@ismcagdas : have you has more information about this limitation on azure app service with linux ? And do you know about other impacts on linux ?
Hi,
I plan to switch an existing app on azure app service windows to azure app service linux. Did you solved this issue ?
I also noticed this logs on UserFriendsCache class.
I have the same beavior
Here is the log :
WARN 2020-04-19 23:40:31,807 [15 ] EN_SOFT.MyAPP.Web.Chat.SignalR.ChatHub - System.Threading.Tasks.TaskCanceledException: A task was canceled.
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
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.QueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, 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.QueryingEnumerable`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 Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase`3.FirstOrDefaultAsync(TPrimaryKey id)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
at Nito.AsyncEx.AsyncContext.<>c__DisplayClass16_0`1.<Run>b__0(Task`1 t)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
at Nito.AsyncEx.AsyncContext.Run[TResult](Func`1 action)
at Abp.Threading.AsyncHelper.RunSync[TResult](Func`1 func)
at MyCOMPANY.MyAPP.Friendships.Cache.UserFriendsCache.GetUserFriendsCacheItemInternal(UserIdentifier userIdentifier) in D:\a\1\s\aspnet-core\src\MyCOMPANY.MyAPP.Core\Friendships\Cache\UserFriendsCache.cs:line 195
at Castle.Proxies.UserFriendsCacheProxy.GetUserFriendsCacheItemInternal_callback(UserIdentifier userIdentifier)
at Castle.Proxies.Invocations.UserFriendsCache_GetUserFriendsCacheItemInternal.InvokeMethodOnTarget()
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Abp.Domain.Uow.UnitOfWorkInterceptor.InterceptSynchronous(IInvocation invocation)
at Castle.DynamicProxy.AsyncDeterminationInterceptor.Intercept(IInvocation invocation)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.UserFriendsCacheProxy.GetUserFriendsCacheItemInternal(UserIdentifier userIdentifier)
at MyCOMPANY.MyAPP.Friendships.Cache.UserFriendsCache.<>c__DisplayClass8_0.<GetCacheItem>b__0(String f) in D:\a\1\s\aspnet-core\src\MyCOMPANY.MyAPP.Core\Friendships\Cache\UserFriendsCache.cs:line 46
at Abp.Runtime.Caching.CacheExtensions.<>c__DisplayClass5_0`2.<Get>b__0(String k)
at Abp.Runtime.Caching.AbpCacheBase`2.Get(TKey key, Func`2 factory)
at Abp.Runtime.Caching.CacheExtensions.Get[TKey,TValue](ICache cache, TKey key, Func`2 factory)
at MyCOMPANY.MyAPP.Friendships.Cache.UserFriendsCache.GetCacheItem(UserIdentifier userIdentifier) in D:\a\1\s\aspnet-core\src\MyCOMPANY.MyAPP.Core\Friendships\Cache\UserFriendsCache.cs:line 44
at Castle.Proxies.UserFriendsCacheProxy.GetCacheItem_callback(UserIdentifier userIdentifier)
at Castle.Proxies.Invocations.UserFriendsCache_GetCacheItem.InvokeMethodOnTarget()
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Abp.Domain.Uow.UnitOfWorkInterceptor.InterceptSynchronous(IInvocation invocation)
at Castle.DynamicProxy.AsyncDeterminationInterceptor.Intercept(IInvocation invocation)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.UserFriendsCacheProxy.GetCacheItem(UserIdentifier userIdentifier)
at MyCOMPANY.MyAPP.Friendships.ChatUserStateWatcher.NotifyUserConnectionStateChange(UserIdentifier user, Boolean isConnected) in D:\a\1\s\aspnet-core\src\MyCOMPANY.MyAPP.Core\Friendships\ChatUserStateWatcher.cs:line 45
at MyCOMPANY.MyAPP.Friendships.ChatUserStateWatcher.OnlineClientManager_UserDisconnected(Object sender, OnlineUserEventArgs e) in D:\a\1\s\aspnet-core\src\MyCOMPANY.MyAPP.Core\Friendships\ChatUserStateWatcher.cs:line 41
at Abp.RealTime.OnlineClientManager.Remove(String connectionId)
at Abp.AspNetCore.SignalR.Hubs.OnlineClientHubBase.OnDisconnectedAsync(Exception exception)
System.Threading.Tasks.TaskCanceledException: A task was canceled.
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
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.QueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, 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.QueryingEnumerable`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 Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase`3.FirstOrDefaultAsync(TPrimaryKey id)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation)
at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
at Nito.AsyncEx.AsyncContext.<>c__DisplayClass16_0`1.<Run>b__0(Task`1 t)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
at Nito.AsyncEx.AsyncContext.Run[TResult](Func`1 action)
at Abp.Threading.AsyncHelper.RunSync[TResult](Func`1 func)
at MyCOMPANY.MyAPP.Friendships.Cache.UserFriendsCache.GetUserFriendsCacheItemInternal(UserIdentifier userIdentifier) in D:\a\1\s\aspnet-core\src\MyCOMPANY.MyAPP.Core\Friendships\Cache\UserFriendsCache.cs:line 195
at Castle.Proxies.UserFriendsCacheProxy.GetUserFriendsCacheItemInternal_callback(UserIdentifier userIdentifier)
at Castle.Proxies.Invocations.UserFriendsCache_GetUserFriendsCacheItemInternal.InvokeMethodOnTarget()
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Abp.Domain.Uow.UnitOfWorkInterceptor.InterceptSynchronous(IInvocation invocation)
at Castle.DynamicProxy.AsyncDeterminationInterceptor.Intercept(IInvocation invocation)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.UserFriendsCacheProxy.GetUserFriendsCacheItemInternal(UserIdentifier userIdentifier)
at MyCOMPANY.MyAPP.Friendships.Cache.UserFriendsCache.<>c__DisplayClass8_0.<GetCacheItem>b__0(String f) in D:\a\1\s\aspnet-core\src\MyCOMPANY.MyAPP.Core\Friendships\Cache\UserFriendsCache.cs:line 46
at Abp.Runtime.Caching.CacheExtensions.<>c__DisplayClass5_0`2.<Get>b__0(String k)
at Abp.Runtime.Caching.AbpCacheBase`2.Get(TKey key, Func`2 factory)
at Abp.Runtime.Caching.CacheExtensions.Get[TKey,TValue](ICache cache, TKey key, Func`2 factory)
at MyCOMPANY.MyAPP.Friendships.Cache.UserFriendsCache.GetCacheItem(UserIdentifier userIdentifier) in D:\a\1\s\aspnet-core\src\MyCOMPANY.MyAPP.Core\Friendships\Cache\UserFriendsCache.cs:line 44
at Castle.Proxies.UserFriendsCacheProxy.GetCacheItem_callback(UserIdentifier userIdentifier)
at Castle.Proxies.Invocations.UserFriendsCache_GetCacheItem.InvokeMethodOnTarget()
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Abp.Domain.Uow.UnitOfWorkInterceptor.InterceptSynchronous(IInvocation invocation)
at Castle.DynamicProxy.AsyncDeterminationInterceptor.Intercept(IInvocation invocation)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.UserFriendsCacheProxy.GetCacheItem(UserIdentifier userIdentifier)
at MyCOMPANY.MyAPP.Friendships.ChatUserStateWatcher.NotifyUserConnectionStateChange(UserIdentifier user, Boolean isConnected) in D:\a\1\s\aspnet-core\src\MyCOMPANY.MyAPP.Core\Friendships\ChatUserStateWatcher.cs:line 45
at MyCOMPANY.MyAPP.Friendships.ChatUserStateWatcher.OnlineClientManager_UserDisconnected(Object sender, OnlineUserEventArgs e) in D:\a\1\s\aspnet-core\src\MyCOMPANY.MyAPP.Core\Friendships\ChatUserStateWatcher.cs:line 41
at Abp.RealTime.OnlineClientManager.Remove(String connectionId)
at Abp.AspNetCore.SignalR.Hubs.OnlineClientHubBase.OnDisconnectedAsync(Exception exception)