@cryptotaxi247 / kubo / commits / 6ff764f9f

fix: preserve Unlimited StreamsInbound in connmgr reconciliation

Fixes #9695

Jorropo committed Mar 15, 2023 at 04:40 UTC 6ff764f9fb1bfbff2625f46c732d3515b0443c70
2 files changed +7 -1
core/node/libp2p/rcmgr.go
+4
@@ -459,6 +459,7 @@ func ensureConnMgrMakeSenseVsResourceMgr(concreteLimits rcmgr.ConcreteLimitConfi
459 return fmt.Errorf(`
460 Unable to initialize libp2p due to conflicting resource manager limit configuration.
461 resource manager System.Conns (%d) must be bigger than ConnMgr.HighWater (%d)
462 +See: https://github.com/ipfs/kubo/blob/master/docs/libp2p-resource-management.md#how-does-the-resource-manager-resourcemgr-relate-to-the-connection-manager-connmgr
463 `, rcm.System.Conns, highWater)
464 }
465 if rcm.System.ConnsInbound != rcmgr.Unlimited && int64(rcm.System.ConnsInbound) <= highWater {
@@ -466,6 +467,7 @@ resource manager System.Conns (%d) must be bigger than ConnMgr.HighWater (%d)
467 return fmt.Errorf(`
468 Unable to initialize libp2p due to conflicting resource manager limit configuration.
469 resource manager System.ConnsInbound (%d) must be bigger than ConnMgr.HighWater (%d)
470 +See: https://github.com/ipfs/kubo/blob/master/docs/libp2p-resource-management.md#how-does-the-resource-manager-resourcemgr-relate-to-the-connection-manager-connmgr
471 `, rcm.System.ConnsInbound, highWater)
472 }
473 if rcm.System.Streams != rcmgr.Unlimited && int64(rcm.System.Streams) <= highWater {
@@ -473,6 +475,7 @@ resource manager System.ConnsInbound (%d) must be bigger than ConnMgr.HighWater
475 return fmt.Errorf(`
476 Unable to initialize libp2p due to conflicting resource manager limit configuration.
477 resource manager System.Streams (%d) must be bigger than ConnMgr.HighWater (%d)
478 +See: https://github.com/ipfs/kubo/blob/master/docs/libp2p-resource-management.md#how-does-the-resource-manager-resourcemgr-relate-to-the-connection-manager-connmgr
479 `, rcm.System.Streams, highWater)
480 }
481 if rcm.System.StreamsInbound != rcmgr.Unlimited && int64(rcm.System.StreamsInbound) <= highWater {
@@ -480,6 +483,7 @@ resource manager System.Streams (%d) must be bigger than ConnMgr.HighWater (%d)
483 return fmt.Errorf(`
484 Unable to initialize libp2p due to conflicting resource manager limit configuration.
485 resource manager System.StreamsInbound (%d) must be bigger than ConnMgr.HighWater (%d)
486 +See: https://github.com/ipfs/kubo/blob/master/docs/libp2p-resource-management.md#how-does-the-resource-manager-resourcemgr-relate-to-the-connection-manager-connmgr
487 `, rcm.System.StreamsInbound, highWater)
488 }
489 return nil
core/node/libp2p/rcmgr_defaults.go
+3 -1
@@ -129,7 +129,9 @@ func createDefaultLimitConfig(cfg config.SwarmConfig) (limitConfig rcmgr.Concret
129 }
130
131 // Scale System.StreamsInbound as well, but use the existing ratio of StreamsInbound to ConnsInbound
132 - partialLimits.System.StreamsInbound = rcmgr.LimitVal(maxInboundConns * int64(partialLimits.System.StreamsInbound) / int64(partialLimits.System.ConnsInbound))
132 + if partialLimits.System.StreamsInbound != rcmgr.Unlimited {
133 + partialLimits.System.StreamsInbound = rcmgr.LimitVal(maxInboundConns * int64(partialLimits.System.StreamsInbound) / int64(partialLimits.System.ConnsInbound))
134 + }
135 partialLimits.System.ConnsInbound = rcmgr.LimitVal(maxInboundConns)
136 }
137