Skip to content

Connections not being closed, even when server sets the "Connection: close" header #324

Closed
@0xpablo

Description

@0xpablo

Hi there,

I'm trying to perform some requests to an embedded device in my local network (by IP address). I noticed that after a few requests, the device would stop responding (requests would time out). It looks like the device supports a limited number of concurrent connections / open sockets, so after going over the limit, requests time out.

The embedded device sets the Connection: close header, but looking inside the Active Connections panel in Xcode, I notice that the connections are not being closed:


Screen Shot 2020-12-23 at 21 22 21

The only workaround I found was to shutdown the HTTPClient used to make the request and create a new one for the next request.

I'm running macOS 11, and the issue happens on both release and debug builds. My code is very similar to the sample code on the README (I don't think I'm doing anything that would cause this issue).

Any ideas?

Thanks in advance!


Environment:

- AsyncHTTPClient commit hash: 947429beb4b3f7515bfe2f1d7bb721318cf30935
- Swift version: Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28) (Version 12.3 (12C33))
- OS: macOS 11.1

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