Skip to content

Conversation

jxs
Copy link
Member

@jxs jxs commented Aug 12, 2025

Description

while addressing the flakiness of the tests I noticed the memory limit was not accurate according to the documentation, documentation mentions the limit is reached not greater than.
This PR fixes that.

To address the flakiness due to now connections being probably a little bit smaller in memory footprint I gave room for a connection threshold in the tests.

@jxs jxs changed the title fix(memory-connection-limits): fix(memory-connection-limits): make memory limit exclusive Aug 12, 2025
@jxs jxs requested review from elenaf9 and dariusc93 August 12, 2025 18:43
Copy link
Member

@elenaf9 elenaf9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that we should change the behavior here.
max_allowed_bytes strongly implies that the set number is still allowed; it's the same also e.g. when setting a max_* in ConnectionLimits.

We could instead simply change the docs to

/// New inbound and outbound connections will be denied when the threshold is exceeded.

@jxs jxs force-pushed the fix-connection-memory-limits branch from 3f1f46b to e2fbcc2 Compare August 12, 2025 19:56
Copy link
Member Author

@jxs jxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that we should change the behavior here.
max_allowed_bytes strongly implies that the set number is still allowed; it's the same also e.g. when setting a max_* in ConnectionLimits.

We could instead simply change the docs to

/// New inbound and outbound connections will be denied when the threshold is exceeded.

My rational was to give users what they had already been expecting from the doc, but yeah you are right, I missed the max_ and the fact that updating the doc is easier than updating the code.
Thanks Elena

@jxs jxs changed the title fix(memory-connection-limits): make memory limit exclusive chore(memory-connection-limits): fix tests Aug 12, 2025
@jxs jxs force-pushed the fix-connection-memory-limits branch from e2fbcc2 to bc71415 Compare August 12, 2025 21:27
@jxs jxs added the send-it label Aug 12, 2025
@mergify mergify bot merged commit dd8107a into libp2p:master Aug 12, 2025
70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants