The TCP listener can be configured to close when a certain number of connections is reached with the closeServerOnMaxConnections option
This option currently only looks at inbound connections when considering when to close the listener
The current behavior makes the option significantly less useful because consumers are not able to configure a # of max connections on which to stop listening, rather only can configure a # of max inbound connections on which to stop listening
This issue requests updating the behavior of the closeServerOnMaxConnections option to consider both # of inbound and # of outbound in determining when to stop listening.
Version: 7.0.1
Platform:
Linux feat2-lg1k-hzax41 5.15.0-73-generic #80-Ubuntu SMP Mon May 15 15:18:26 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Subsystem:
Severity:
Medium
Description:
libp2p is designed to close server on max connections, however it's only count on inbound connections, it should count on total connections instead https://github.com/libp2p/js-libp2p/blob/5ffa7a74d5b972bdac387782d6010b6a19558600/packages/transport-tcp/src/listener.ts#L68C20-L68C31
in lodestar, normally
maxConnections
is configured as 55 peers. However total peers could be more than thatlibp2p_tcp_inbound_connections_total
is consistently <= 55Steps to reproduce the error: