Skip to content

resource-manager: "conn" limits are not applied to connLimiter #3431

@hsanjuan

Description

@hsanjuan

The documentation says:

How to disable limits

Sometimes disabling all limits is useful when you want to see how much resources you use during normal operation. You can then use this information to define your initial limits. Disable the limits by using InfiniteLimits.

https://pkg.go.dev/github.com/libp2p/[email protected]/p2p/host/resource-manager#section-readme

InfiniteLimits sets the conn limit to infinite: https://github.com/libp2p/go-libp2p/blob/v0.45.0/p2p/host/resource-manager/limit_defaults.go#L867-L878

Yet, the connLimiter, which is in charge of limiting connections, is created bare and does not know about the limits: https://github.com/libp2p/go-libp2p/blob/v0.45.0/p2p/host/resource-manager/rcmgr.go#L139-L149 (I´d say same for connRateLimiter).

The connLimiter has a default limit of 8 concurrent connections for an IP: https://github.com/libp2p/go-libp2p/blob/v0.45.0/p2p/host/resource-manager/conn_limiter.go#L35-L38

So, the limits are not disabled. The work around of using a NullResourceManager works, it is just not documented.

As a side note, GOLOG_LOG_LEVEL="rcmgr=debug" is no help to discover this issue, as this is logged in the upgrader, which means someone monitoring for resource manager errors will miss these unless debug logging is enabled in the upgrader.

As a second side note, GOLOG_LOG_LEVEL doesn't work without special setup anymore via gologshim.

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