Aspnetcore: SignalR timeout option not working, default settings not working too

Created on 26 Jul 2019  路  3Comments  路  Source: dotnet/aspnetcore

Bug Description

When a client connects to my SignalR project and the client internet is disabled, the disconnect event is called (connection terminated) after about 15:40 minutes.
I noticed the problem recently as the last time I tried the same scenario, the connection was terminated after 30 seconds.
I tried to do the same thing without setting hub option and also by setting

services.AddSignalR(hubOptions =>
{
    hubOptions.EnableDetailedErrors = true;
    hubOptions.HandshakeTimeout = TimeSpan.FromSeconds(15);
    hubOptions.ClientTimeoutInterval = TimeSpan.FromSeconds(30);
    hubOptions.KeepAliveInterval = TimeSpan.FromSeconds(15);
});

but still no difference.
I also ran the project with docker with and without setting
/proc/sys/net/ipv4/tcp_keepalive_time
value to 30 seconds but the client disconnected again in over 15 minutes.
I also tested it under net core 2,1, 2.2, and 3.0 but again no difference
I used two clients to test it, one with an android project and one with a c# client
I ran ngrok to expose the port 8223 to the public
ran the net core project with application url localhost:8223
connected the android client to it
when the log of the connection handshake handled was received, I disabled the internet
then after around 15 minutes the disconnect log was printed.
also tried to connect a c# client from a different computer to the net core project.
The connection handshake log was printed, I turned the internet off
and again the disconnect log was printed only after around 15 minutes .

To Reproduce

Steps to reproduce the behavior:

  1. Download ngrok from https://ngrok.com/
  2. Run the 'ngrok http 8223' command to expose the 8223 port
  3. Run the following dotnetcore application
    https://github.com/BassV/SignalR-Issue-DotNetCore/tree/master/ChatSample
  4. Run the following android app a device
    https://github.com/BassV/SignalR-Issue-Android
  5. When the connection log is printed, disable the internet of the android device
  6. Wait until the disconnect log is printed
  7. It would take around 15:40 minutes instead of the set 30 seconds

Expected behavior

After losing connection, the SignalR disconnect method must be called after 30 seconds if its hub option is not set or at the set interval when set, however it doesn't.

Screenshots

Capture
The screenshot shows the time it took for the disconnect method to be called

Author Feedback area-signalr

All 3 comments

You're using a third-party library "com.smartarmenia:dotnetcoresignalrclientjava" which is not supported by us.

In order to have the server detect clients disconnecting within the configured timeout window, the client needs to be version 1.1 or higher for our supported clients and unsupported clients need to send a ping message to start the timeout.

You said you tried the C# client, what version were you using? And if you were using 1.1 or higher could you provide a repro app?

Closing this as we haven't heard from you and generally close issues with no response after some time. Please feel free to comment if you're able to get the information we're looking for and we can reopen the issue to investigate further!

I was using 1.0.4 version in the C# client, upgraded to 1.1 and it worked.
Thanks a lot for the help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Rast1234 picture Rast1234  路  104Comments

mkArtakMSFT picture mkArtakMSFT  路  89Comments

davidfowl picture davidfowl  路  126Comments

reduckted picture reduckted  路  91Comments

radenkozec picture radenkozec  路  114Comments