-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
I am using Restsharp to do regular GET requests to several hosts.
After several days of running at about 250 requests per hour in a multi-threaded environment, all requests will fail and timeout with the message: The connection was closed unexpectedly.
The host doesn't see the request and restarting the application cures the problem.
The same request with Curl will work without problem.
The code is as is:
var Client = new RestClient("http://...");
var Request = new RestRequest("...", Method.GET);
Request.AddHeader("X-auth-Token", KEY);
Request.AddQueryParameter("timeFrame", TimeFrame);
// execute the query
var Response = Client.Execute(Request);
if (Response.StatusCode != HttpStatusCode.OK)
{
return false;
}
So nothing special, just a lot of parallel requests for a long time will create that problem.
The data returned is quite large, if it makes a difference.
From the symptoms, it looks like RestSharp is just not able to open a socket anymore, so maybe there is something still hanging after each call.
This is using the latest from Nuget, in a .NET 4.7 app and running on Windows Server 2016.