Skip to content

CURLMOPT_MAX_HOST_CONNECTIONS is ignored with CURL_LOCK_DATA_CONNECT #22265

Description

@GrahamCampbell

I did this

Set CURLMOPT_MAX_HOST_CONNECTIONS (and/or CURLMOPT_MAX_TOTAL_CONNECTIONS) on a multi handle whose easy handles use a share handle with CURL_LOCK_DATA_CONNECT, then ran many concurrent transfers to one host.

I expected the following

The configured limits to be respected, as they were before 8.13.0. Instead they are silently not enforced at all: since df67269, Curl_cpool_check_limits() reads the limits from cpool->idata->multi, and a share-owned pool's admin handle is never attached to any multi, so both limits resolve to 0 and the check always passes. In 8.10 through 8.12 the limits came from the transfer's own data->multi and were enforced against whichever pool the transfer used.

The change looks unintentional: df67269 only discusses shutdown handling, and no documentation or release note mentions it. It is also untested — commit 55968fd added the connection limit tests but commented out CURL_LOCK_DATA_CONNECT in the hx-download test client in the same commit (still disabled via #if 0 today), so the in-tree tests only pass with connection sharing off.

Real-world impact: symfony/symfony#64040, worked around downstream by dropping connection sharing (symfony/symfony#64046).

curl/libcurl version

Issue present in curl 8.13.0 through 8.21.0 (at time of writing).

operating system

Not OS-dependent. Replicated on both macOS 26.5 and Ubuntu 24.04.

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