Skip to content

The request was aborted: The connection was closed unexpectedly #1053

@thomasd3

Description

@thomasd3

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions