Skip to content

SignalR prevents .NET8 app to stop if clients are connected #53165

@pedroveiga99

Description

@pedroveiga99

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have a Blazor App (the repo given is from the Blazor Webassembly Standalone App with ASP.NET Core Hosted option, but this bug also occurs when using the new Blazor Web App template). In the app a signalR connection between the server and client is opened. When I close the program there are two different behaviors in .NET7 and .NET8.

  • In .NET7, when i send the shut down command to the app, it shutdowns immediately and closes all opened connections.
  • In .NET8, when i send the shut down command to the app, it logs that the application is shutting down but it takes ~10s to send me a message that the signalR client has disconnected and only after that it really exits the app.

I would assume that the .NET7 version is the correct behavior.

Expected Behavior

Log in .NET7

12:30:51 info: SignalRProblem.NotificationHub[0]
      Notif WS connected: 8m-yY_W585vGcU7ce9IceA
12:30:54 info: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...
12:30:54 info: SignalRProblem.NotificationHub[0]
      Notif WS disconnected: 8m-yY_W585vGcU7ce9IceA

Log in .NET8

12:29:44 info: SignalRProblem.NotificationHub[0]
      Notif WS connected: HXvhuJ8p6LnHKe16xnU5oA
12:29:48 info: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...
12:30:00 info: SignalRProblem.NotificationHub[0]
      Notif WS disconnected: HXvhuJ8p6LnHKe16xnU5oA

Note the time difference between the "Application is shutting down" message and the "Notif WS disconnected" message

Steps To Reproduce

Minimal Repo

This repo is targeting the .NET7 framework. You could just change the Server project to target the .NET8 version and the problem will occur.

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-signalrIncludes: SignalR clients and servers

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions