Skip to content

HTTPClient.remoteConnectionClosed errors #488

@MahdiBM

Description

@MahdiBM

Current Behavior

After a few hours, e.g. 2.5 hours, my app starts to throw HTTPClient.remoteConnectionClosed errors.

Expected Behavior

No HTTPClient errors should be thrown.

What am i doing?

In Vapor, I have a piece of code like so:

let clientRequest = ClientRequest(url: uri, headers: headers)
return app.client.send(clientRequest)

This method is called 2.5/s, and basically crawls another API.
Though, when the errors start happening, the throwing happens even outside this code, and with every eligible API call.

More Info

  • I've tested with v1.7.0 and latest commit and 1.6.4.
    Everything works fine on 1.6.4, but using the other two results in the error.
  • Happens with heavier response bodies (~100kb +). I haven't seen it happen with a req with res body of like 10/20 kb, probably due to it having less chance to happen.
  • Happens only after a few hours of my app's start. Something in range of 2-4, usually like 2.5.
  • I haven't tested without the code that is calling another api 2.5 times per second. So not sure if the errors start to happen due to some kind of resource being exhausted, or other reasons.
  • Haven't tested with setting httpVersion from .automatic to .http1Only. Can try this if you need more info.

I can attempt to make a repro project if it seems necessary.

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