Azure / azure-signalr

Azure SignalR Service SDK for .NET

Home Page:https://aka.ms/signalr-service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SignalR reconnection exception

v-dsahithi opened this issue · comments

We have a Blazor WASM solution where we are using an Azure SignalR service. In the Blazor client we have attached to the event Microsoft.AspNetCore.SignalR.Client.HubConnection.Reconnected:
'HubConnection.Reconnected += OnHubConnectionReconnectedAsync;'

In the last 30 days we have seen the below exception 54 times in our production environment:
'InvalidOperationException: Websocket closed with error: 1006.'

By looking at the logs we can't figure out why this happens. We have followed the links below to enable logging:

Web app name: prod-mcz-electricitymarketcontrol-app
SignalR service: prod-mcz-signalr

Operation Ids:

  • f0363f9e59d04ba392919ef673682d9c (8/7/2023, 09:30:41.747 AM UTC)
  • 9a9286877e684f7d94da3cf780a0c3aa (8/4/2023, 5:39:58.445 PM UTC)

Exceptions (if any)

'InvalidOperationException: Websocket closed with error: 1006.'

Further technical details

OperationId: ba8d1513feed49f9a23c24b31e7e4a73
notification connectionId: q6avp9P_QMyScZkn7c0iKwXv7c8Ad02
globalnotification connectionId: AM_UFKT6-ocVnwJiUKR4jgitAj5Qd02

Client log:
"InvalidOperationException: Websocket closed with error: 1006." (7/29/2023 4:59:44.678 AM UTC)

SignalR service logs
"Connection aborted. Reason: Application server closed the connection." (7/29/2023, 5:00:06.000 AM UTC)
"Connection ended. Reason: Application server closed the connection."

It looks like the exception happens on the client first and then "Application server closed the connection".
No deploys when the exceptions happened.

We have already looked into the server logs under namespace “Microsoft.Azure” but we can’t see that it disconnects.

Checked with microsoft signalR product team, Regarding the 1006 exception, this exception is thrown when a WebSocket connection was closed abnormally. An example would be failure to perform TCP handshake. This usually happens locally, meaning it is not something caused by Azure SignalR. Can the SignalR client SDK help me more here.

Application server closed the connection usually happens when client-server ping timeout, you can enable server side trace log to see ping timeout logs from the server side following :https://learn.microsoft.com/en-us/aspnet/core/signalr/diagnostics?view=aspnetcore-7.0#server-side-logging

Client side log "WebSocket closed with 1006" also indicates client side network issue

Thank you for the response.