Skip to content

http: limit connected HTTPRemoteClients (PR #35730) - Follow-up 3 of 4 #534

Description

@kevkevinpal

mentioned in: bitcoin#35730

bitcoin#35730 (comment)

"I didn't keep up with all the http follow-ups in the last couple of weeks, so sorry if I am missing something here. But making the max rpc connections part of the minimum fds means that the minimum fds is raised significantly. I am not sure if we still support systems where this is a problem and the default setting wouldn't start under usual circumstances. But it feels weird to require a maximum that will likely be never reached for any usual usage as part of the global minimum.

What would seem more natural to me but requires a bit of further restructuring is something like this:

base_fds = core + addnode + p2p_binds + rpc_binds;
min_http_connections = std::min(requested_rpc_connections, 16);
min_required_fds = base_fds + min_http_connections;

if (available_fds < min_required_fds) {
    return InitError(...);
}

int remaining = available_fds - min_required_fds;

// Prioritize ordinary P2P capacity.
nMaxConnections = std::min(remaining, user_max_connection);
remaining -= nMaxConnections;

// Use remaining fd capacity to raise HTTP above the min.
effective_rpc_max_connections =
    min_http_connections +
    std::min(remaining, requested_rpc_connections - min_http_connections);

So we are checking if we have an actual minimum available that should be sufficient rather than the maximum and depending on what's available we take what we get up until the maximum." - fjahr

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    followupThis is a possible follow-up someone can work onneed to confirmNeed to confirm if this is still needed or already done

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions