Description:
I have been annoyed for a while, because my log file of my Blazor application is full of the exceptions shown below. Locally on my development computer as well as on Azure.
There are no visible effects, but a log file / Azure monitoring overflowing with errors is still disturbing.
Now I have finally found out when the error occurs. Every time the browser tab in which the Blazor app is running is closed. I.e. if I have the application open in 5 tabs and then close them all, I have these 3 exceptions in the log 5 times.
The problem only occurs when I am in the Blazor app, but not on the login page, which runs with MVC.
However, it also occurs when I switch from the Blazor app to the profile page, which also runs with MVC.
Conclusion: As soon as I close the Blazor app in any way, I have the error in the log.
Unfortunately I haven't found a solution yet... Can this be solved by configuration? You should also have this problem, because I have generated my project with your template.
In my earlier ABP Blazor projects (ABP version 8.0.4 and 8.1.0) this problem does not exist.
Exception message and full stack trace:
2025-03-21T15:12:30.498594964Z [15:12:30 WRN] The operation was canceled.
2025-03-21T15:12:30.498626168Z System.OperationCanceledException: The operation was canceled.
2025-03-21T15:12:30.498630914Z at System.Threading.CancellationToken.ThrowOperationCanceledException()
2025-03-21T15:12:30.499695960Z at Microsoft.Extensions.Caching.StackExchangeRedis.RedisCache.GetAsync(String key, CancellationToken token)
2025-03-21T15:12:30.499710156Z at Volo.Abp.Caching.DistributedCache`2.GetAsync(TCacheKey key, Nullable`1 hideErrors, Boolean considerUow, CancellationToken token)
2025-03-21T15:12:30.508186494Z [15:12:30 ERR] Error when dispatching 'OnDisconnectedAsync' on hub.
2025-03-21T15:12:30.508204006Z System.Threading.Tasks.TaskCanceledException: A task was canceled.
2025-03-21T15:12:30.508208351Z at Volo.Abp.Threading.SemaphoreSlimExtensions.LockAsync(SemaphoreSlim semaphoreSlim, CancellationToken cancellationToken)
2025-03-21T15:12:30.508212734Z at Volo.Abp.Caching.DistributedCache`2.GetOrAddAsync(TCacheKey key, Func`1 factory, Func`1 optionsFactory, Nullable`1 hideErrors, Boolean considerUow, CancellationToken token)
2025-03-21T15:12:30.508216835Z at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributorCache.GetAsync(Guid userId, Nullable`1 tenantId)
2025-03-21T15:12:30.508220579Z at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributor.ContributeAsync(AbpClaimsPrincipalContributorContext context)
2025-03-21T15:12:30.508224471Z at Volo.Abp.Security.Claims.AbpClaimsPrincipalFactory.InternalCreateAsync(AbpClaimsPrincipalFactoryOptions options, ClaimsPrincipal existsClaimsPrincipal, Boolean isDynamic)
2025-03-21T15:12:30.508228453Z at Volo.Abp.Security.Claims.AbpClaimsPrincipalFactory.CreateDynamicAsync(ClaimsPrincipal existsClaimsPrincipal)
2025-03-21T15:12:30.508232343Z at Volo.Abp.AspNetCore.SignalR.Authentication.AbpAuthenticationHubFilter.HandleDynamicClaimsPrincipalAsync(ClaimsPrincipal claimsPrincipal, IServiceProvider serviceProvider, HubCallerContext hubCallerContext, Boolean skipCheckDynamicClaimsInterval)
2025-03-21T15:12:30.508237154Z at Volo.Abp.AspNetCore.SignalR.Authentication.AbpAuthenticationHubFilter.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
2025-03-21T15:12:30.508240927Z at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
2025-03-21T15:12:30.508259520Z at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
2025-03-21T15:12:30.508263733Z at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
2025-03-21T15:12:30.508267595Z at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
2025-03-21T15:12:30.508271986Z at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.OnDisconnectedAsync(HubConnectionContext connection, Exception exception)
2025-03-21T15:12:30.508275817Z at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.OnDisconnectedAsync(HubConnectionContext connection, Exception exception)
2025-03-21T15:12:30.508279633Z at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.HubOnDisconnectedAsync(HubConnectionContext connection, Exception exception)
2025-03-21T15:12:30.509313222Z [15:12:30 ERR] Failed disposing connection RfusBEBpFoUp9uL-jjOGqQ.
2025-03-21T15:12:30.509330226Z System.Threading.Tasks.TaskCanceledException: A task was canceled.
2025-03-21T15:12:30.509609315Z at Volo.Abp.Threading.SemaphoreSlimExtensions.LockAsync(SemaphoreSlim semaphoreSlim, CancellationToken cancellationToken)
2025-03-21T15:12:30.509620537Z at Volo.Abp.Caching.DistributedCache`2.GetOrAddAsync(TCacheKey key, Func`1 factory, Func`1 optionsFactory, Nullable`1 hideErrors, Boolean considerUow, CancellationToken token)
2025-03-21T15:12:30.509825846Z at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributorCache.GetAsync(Guid userId, Nullable`1 tenantId)
2025-03-21T15:12:30.509854785Z at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributor.ContributeAsync(AbpClaimsPrincipalContributorContext context)
2025-03-21T15:12:30.510047633Z at Volo.Abp.Security.Claims.AbpClaimsPrincipalFactory.InternalCreateAsync(AbpClaimsPrincipalFactoryOptions options, ClaimsPrincipal existsClaimsPrincipal, Boolean isDynamic)
2025-03-21T15:12:30.510056019Z at Volo.Abp.Security.Claims.AbpClaimsPrincipalFactory.CreateDynamicAsync(ClaimsPrincipal existsClaimsPrincipal)
2025-03-21T15:12:30.510059319Z at Volo.Abp.AspNetCore.SignalR.Authentication.AbpAuthenticationHubFilter.HandleDynamicClaimsPrincipalAsync(ClaimsPrincipal claimsPrincipal, IServiceProvider serviceProvider, HubCallerContext hubCallerContext, Boolean skipCheckDynamicClaimsInterval)
2025-03-21T15:12:30.510063008Z at Volo.Abp.AspNetCore.SignalR.Authentication.AbpAuthenticationHubFilter.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
2025-03-21T15:12:30.510066606Z at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
2025-03-21T15:12:30.510070016Z at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
2025-03-21T15:12:30.510072984Z at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
2025-03-21T15:12:30.510084402Z at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
2025-03-21T15:12:30.510087658Z at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.OnDisconnectedAsync(HubConnectionContext connection, Exception exception)
2025-03-21T15:12:30.510090636Z at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.OnDisconnectedAsync(HubConnectionContext connection, Exception exception)
2025-03-21T15:12:30.510093493Z at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.HubOnDisconnectedAsync(HubConnectionContext connection, Exception exception)
2025-03-21T15:12:30.510096451Z at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.RunHubAsync(HubConnectionContext connection)
2025-03-21T15:12:30.510099320Z at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.OnConnectedAsync(ConnectionContext connection)
2025-03-21T15:12:30.510114188Z at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.OnConnectedAsync(ConnectionContext connection)
2025-03-21T15:12:30.510118175Z at Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionContext.ExecuteApplication(ConnectionDelegate connectionDelegate)
2025-03-21T15:12:30.510121767Z at Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionContext.WaitOnTasks(Task applicationTask, Task transportTask, Boolean closeGracefully)
2025-03-21T15:12:30.510125314Z at Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionContext.DisposeAsync(Boolean closeGracefully)
2025-03-21T15:12:30.510128896Z at Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionManager.DisposeAndRemoveAsync(HttpConnectionContext connection, Boolean closeGracefully, HttpConnectionStopStatus status)
Thanks for help,
Adrian
5 Answer(s)
-
0
I have now compared the logs between a working application with ABP 8.1.0 and my problem app with version with ABP 8.2.2.
Here is the difference in the log when closing a browser tab:
Blazor Server App with ABP 8.1.0 (everything fine)
2025-03-21 17:25:10.677 +01:00 [INF] Request starting HTTP/2 POST https://localhost:44341/_blazor/disconnect - multipart/form-data; boundary=----WebKitFormBoundaryLKTHDnNIYH3gmiLr 359 2025-03-21 17:25:10.678 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri. 2025-03-21 17:25:10.678 +01:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri. 2025-03-21 17:25:10.678 +01:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType. 2025-03-21 17:25:10.678 +01:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by Volo.Abp.Account.Web.Pages.Account.OpenIddictImpersonateInferEndpointType. 2025-03-21 17:25:10.678 +01:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateTransportSecurityRequirement. 2025-03-21 17:25:10.678 +01:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader. 2025-03-21 17:25:10.687 +01:00 [DBG] Get dynamic claims cache for user: 7feb2acd-742e-5eea-91ce-3a11e4ceaa41 2025-03-21 17:25:10.688 +01:00 [INF] Executing endpoint 'Blazor disconnect' 2025-03-21 17:25:10.767 +01:00 [INF] Executed endpoint '/_blazor' 2025-03-21 17:25:10.767 +01:00 [INF] Request finished HTTP/1.1 GET https://localhost:44341/_blazor?id=RDJXbzEi_-BTtSeihTm2Yg - 101 null null 19127.4719ms
Blazor Server App with ABP 8.2.2
2025-03-21 17:18:52.406 +01:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri. 2025-03-21 17:18:52.414 +01:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri. 2025-03-21 17:18:52.433 +01:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType. 2025-03-21 17:18:52.451 +01:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by Volo.Abp.Account.Web.Pages.Account.OpenIddictImpersonateInferEndpointType. 2025-03-21 17:18:52.506 +01:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateTransportSecurityRequirement. 2025-03-21 17:18:52.533 +01:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader. 2025-03-21 17:18:52.551 +01:00 [DBG] Get dynamic claims cache for user: f487c7e2-64bf-73ca-b12f-3a13383af04e 2025-03-21 17:18:52.601 +01:00 [DBG] Get dynamic claims cache for user: f487c7e2-64bf-73ca-b12f-3a13383af04e 2025-03-21 17:18:52.617 +01:00 [WRN] The operation was canceled. System.OperationCanceledException: The operation was canceled. at System.Threading.CancellationToken.ThrowOperationCanceledException() at Microsoft.Extensions.Caching.StackExchangeRedis.RedisCache.GetAsync(String key, CancellationToken token) at Volo.Abp.Caching.DistributedCache`2.GetAsync(TCacheKey key, Nullable`1 hideErrors, Boolean considerUow, CancellationToken token) 2025-03-21 17:18:53.212 +01:00 [ERR] Error when dispatching 'OnDisconnectedAsync' on hub. System.Threading.Tasks.TaskCanceledException: A task was canceled. at Volo.Abp.Threading.SemaphoreSlimExtensions.LockAsync(SemaphoreSlim semaphoreSlim, CancellationToken cancellationToken) at Volo.Abp.Caching.DistributedCache`2.GetOrAddAsync(TCacheKey key, Func`1 factory, Func`1 optionsFactory, Nullable`1 hideErrors, Boolean considerUow, CancellationToken token) at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributorCache.GetAsync(Guid userId, Nullable`1 tenantId) at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributor.ContributeAsync(AbpClaimsPrincipalContributorContext context) at Volo.Abp.Security.Claims.AbpClaimsPrincipalFactory.InternalCreateAsync(AbpClaimsPrincipalFactoryOptions options, ClaimsPrincipal existsClaimsPrincipal, Boolean isDynamic) at Volo.Abp.Security.Claims.AbpClaimsPrincipalFactory.CreateDynamicAsync(ClaimsPrincipal existsClaimsPrincipal) at Volo.Abp.AspNetCore.SignalR.Authentication.AbpAuthenticationHubFilter.HandleDynamicClaimsPrincipalAsync(ClaimsPrincipal claimsPrincipal, IServiceProvider serviceProvider, HubCallerContext hubCallerContext, Boolean skipCheckDynamicClaimsInterval) at Volo.Abp.AspNetCore.SignalR.Authentication.AbpAuthenticationHubFilter.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next) at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next) at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next) at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next) at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next) at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.OnDisconnectedAsync(HubConnectionContext connection, Exception exception) at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.OnDisconnectedAsync(HubConnectionContext connection, Exception exception) at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.HubOnDisconnectedAsync(HubConnectionContext connection, Exception exception) 2025-03-21 17:18:53.676 +01:00 [ERR] Failed disposing connection Lk2CIWX22T3WTLFJ1qejhg. System.Threading.Tasks.TaskCanceledException: A task was canceled. at Volo.Abp.Threading.SemaphoreSlimExtensions.LockAsync(SemaphoreSlim semaphoreSlim, CancellationToken cancellationToken) at Volo.Abp.Caching.DistributedCache`2.GetOrAddAsync(TCacheKey key, Func`1 factory, Func`1 optionsFactory, Nullable`1 hideErrors, Boolean considerUow, CancellationToken token) at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributorCache.GetAsync(Guid userId, Nullable`1 tenantId) at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributor.ContributeAsync(AbpClaimsPrincipalContributorContext context) at Volo.Abp.Security.Claims.AbpClaimsPrincipalFactory.InternalCreateAsync(AbpClaimsPrincipalFactoryOptions options, ClaimsPrincipal existsClaimsPrincipal, Boolean isDynamic) at Volo.Abp.Security.Claims.AbpClaimsPrincipalFactory.CreateDynamicAsync(ClaimsPrincipal existsClaimsPrincipal) at Volo.Abp.AspNetCore.SignalR.Authentication.AbpAuthenticationHubFilter.HandleDynamicClaimsPrincipalAsync(ClaimsPrincipal claimsPrincipal, IServiceProvider serviceProvider, HubCallerContext hubCallerContext, Boolean skipCheckDynamicClaimsInterval) at Volo.Abp.AspNetCore.SignalR.Authentication.AbpAuthenticationHubFilter.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next) at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next) at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next) at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next) at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next) at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.OnDisconnectedAsync(HubConnectionContext connection, Exception exception) at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.OnDisconnectedAsync(HubConnectionContext connection, Exception exception) at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.HubOnDisconnectedAsync(HubConnectionContext connection, Exception exception) at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.RunHubAsync(HubConnectionContext connection) at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.OnConnectedAsync(ConnectionContext connection) at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.OnConnectedAsync(ConnectionContext connection) at Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionContext.ExecuteApplication(ConnectionDelegate connectionDelegate) at Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionContext.WaitOnTasks(Task applicationTask, Task transportTask, Boolean closeGracefully) at Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionContext.DisposeAsync(Boolean closeGracefully) at Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionManager.DisposeAndRemoveAsync(HttpConnectionContext connection, Boolean closeGracefully, HttpConnectionStopStatus status)
In the version below with the exception, you can see that the following is missing:
2025-03-21 17:25:10.677 +01:00 [INF] Request starting HTTP/2 POST https://localhost:44341/_blazor/disconnect - multipart/form-data; boundary=----WebKitFormBoundaryLKTHDnNIYH3gmiLr 359
What could be the reason for this?
-
0
I would like to reproduce the error in a newly generated solution. Unfortunately, I can't find out how to generate a new solution in a specific (old) version using CLI or ABP Studio... how can I do that? Do I need to downgrade the CLI or the Studio first?
EDIT: Ok, I've figured it out... Uninstall the CLI and reinstall the corresponding version. It would be nice if you could also select the version when creating a solution via ABP Studio.
-
0
I would like to reproduce the error in a newly generated solution. Unfortunately, I can't find out how to generate a new solution in a specific (old) version using CLI or ABP Studio... how can I do that? Do I need to downgrade the CLI or the Studio first?
EDIT: Ok, I've figured it out... Uninstall the CLI and reinstall the corresponding version. It would be nice if you could also select the version when creating a solution via ABP Studio.
Hi, we have an internal issue supporting selecting a version when creating a solution, but unfortunately could not prioritize it yet. I'll talk with the team.
Regards.
-
0
Unfortunately, I have not been able to create a solution with LeptonX (and version 8.2.2). Even when I specified
--theme leptonx
, LeptonXLite was generated.
Well, it's not that relevant for finding a solution anyway.
-
0
To my real problem:
Unfortunately, I could not reproduce the error with newly generated solutions. Not even with older versions.
I originally created the project with 8.2.0-rc.5 and later updated it to 8.2.2. Perhaps an error occurred somewhere there that led to this behavior.
Can you tell me which files I could start with for my search? What could be wrong so that the disconnect request is not sent by the client? (https://localhost:44341/_blazor/disconnect is missing)