Blazor Server - Unable to connect to the remote server

Viewed 22

I've a Blazor Server app hosted on Azure App Service that's crashing in a certain interval of time.

The error is:

will retry after the back off period. Error detail: Unable to connect to the remote server. An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.

By researching here at stack overflow, i found a cause saying that the number of connections reached the limit. so, going to metric/connections I've this graphic repeating a pattern: Connections always increasing in a linear way and then all goes down suddenly:

enter image description here

This pattern was repeating when the instance was only capable to handle 2000 connections. My first attempt to fix this was to double the capacity of the instance to allow 4000 connection. Now , I've the same pattern, but reaching 4k and then going down suddenly. The problem is that sometimes the app crash and only a restart can fix it.

Also, I researched here on StackOverflow some possible solution and I changed the program.cs to:

builder.Services.AddServerSideBlazor()
   .AddHubOptions(options =>
   {
       options.ClientTimeoutInterval = TimeSpan.FromSeconds(30);
       options.EnableDetailedErrors = false;
       options.HandshakeTimeout = TimeSpan.FromSeconds(15);
       options.KeepAliveInterval = TimeSpan.FromSeconds(15);
       options.MaximumParallelInvocationsPerClient = 1;
       options.MaximumReceiveMessageSize = 32 * 1024;
       options.StreamBufferCapacity = 10;
   });

But this can't do any difference. I believe that if I increase the instance once again for 8k, for example...this will blow up in 8k...There is some leak happening and I've no clue how to fix it. Any suggestion ?

0 Answers
Related