go-libp2p
go-libp2p copied to clipboard
Relay reservation constraints "rate limit" vs "active limit"
When a relay-reserver peer is disconnected from a relay "server" (the middleman providing the relay service), its relay reservation is deleted, but the "relay constraints" are not updated accordingly. Relay constraints are only deleted after 30min TTL.
If reservers connect and disconnect multiple times, it soon results in too many reservations
or too many reservations for peer
to be returned even though there are not actually that many reservations.
Is this the intention behind the constraints, to be a "new reserver connection rate limiter" instead of a "total active reservation limiter"?
Related quirk is that "active relay reservations" can exceed MaxReservations
. When a reserver remains connected for longer than 30min (regularly refreshing its TTL), it is deleted from the constraints, while the reservation remains active, allowing additional reservations to be added.
Yeah, this sounds like two bugs. Thanks for the find. Any interest in taking a stab at the implementation?
Another idea (on top of the fixes) we had while thinking about this was to add some canonical logging when a peer makes a reservation. This way we can hook into fail2ban if a peer is repeatedly connecting, reserving, and disconnecting
Ok cool, I'll give it a shot.
Here is my proposed solution:
- Clean "relay constraints" on disconnect.
- Update "relay constraints TTL" when reservations are refreshed
- Deprecate "MaxReservations" since there can only ever be 1 reservation per peer.
I'm going to leave out the canonical logging. I'll try to add that subsequently in another PR.
Deprecate "MaxReservations" since there can only ever be 1 reservation per peer.
Yeah, I'm not sure why the default is 4. @marten-seemann any insight here?
Deprecate "MaxReservations" since there can only ever be 1 reservation per peer.
Yeah, I'm not sure why the default is 4. @marten-seemann any insight here?
There may be some transitory state where you may have more than 1 reservation per peer, but not sure yet.
@corverroos have you gotten a chance to dig into this? No worries if not
Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.
This issue was closed because it is missing author input.
This issue was closed because it is missing author input.