Close sessions for lost WebSockets to prevent zombie SyncPlay groups (#17079)

Close sessions for lost WebSockets to prevent zombie SyncPlay groups
This commit is contained in:
Enea D'Angiò
2026-07-02 19:36:48 +02:00
committed by GitHub
parent 379c58a48d
commit 8f3eb3205d
3 changed files with 159 additions and 2 deletions
@@ -127,8 +127,12 @@ namespace Emby.Server.Implementations.HttpServer
{
receiveResult = await _socket.ReceiveAsync(memory, cancellationToken).ConfigureAwait(false);
}
catch (WebSocketException ex)
catch (Exception ex) when (ex is WebSocketException or ObjectDisposedException or OperationCanceledException)
{
// ObjectDisposedException/OperationCanceledException: the socket was torn
// down underneath us (e.g. by the keep-alive watchdog after the connection
// was declared lost). Fall through so Closed is still raised and the
// session can release this connection.
_logger.LogWarning("WS {IP} error receiving data: {Message}", RemoteEndPoint, ex.Message);
break;
}