go-libp2p icon indicating copy to clipboard operation
go-libp2p copied to clipboard

Reconcile Conn manager's hi/lo watermarks and the resource manager's limits

Open MarcoPolo opened this issue 3 years ago • 1 comments

Right now the connection manager has a notion of trimming excess connections when they pass the high watermark. The resource manager also blocks any connection once limits have been hit. If users aren't careful these two can conflict (e.g. the resource manager's limits are lower then the low water mark then the connection manager does nothing).

go-ipfs and lotus currently work around this by manually changing the resource manager config if they notice this conflict: https://github.com/filecoin-project/lotus/pull/8318/files#diff-35cf91183413be0bba4bf8770ad60d113f95b79d680e9a9b8bb3fe6e1d99668dR45

I think this should be flipped. The resource manager should be the source of truth for the number of max connections, and the connection manager's lo/hi watermarks should be based on those.

We should do the right thing by default here too in go-libp2p. And log an error if a user passes in conflicting values manually.

MarcoPolo avatar Jul 05 '22 17:07 MarcoPolo

Removing help wanted here because this is kind of hard, and because it would be very bad if this went wrong because nodes would not be able to connect to the network.

MarcoPolo avatar Jun 19 '23 17:06 MarcoPolo