resource-manager: "conn" limits are not applied to connLimiter
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.9k
- Forks
- 1.3k
- Avg merge
- 13d 21h
- Merged PRs (30d)
- 1
Description
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/go-libp2p@v0.45.0/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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing limit_defaults.go with the connLimiter and connRateLimiter construction in rcmgr.go, then inspect the per-IP default in conn_limiter.go. Verify the behavior with InfiniteLimits and the existing resource-manager tests; done means the documented way to disable limits also disables these connection limits, or the documentation explicitly explains the required workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100