Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXPERIMENTAL! Packet read ops accounting and limiting #6651

Open
wants to merge 4 commits into
base: minor-next
Choose a base branch
from

Conversation

dktapps
Copy link
Member

@dktapps dktapps commented Mar 12, 2025

This PR implements the system described in pmmp/BedrockProtocol#301.

By default, the system will only warn when the read ops budget is depleted. In the future, once the defaults are dialled in, this will kick the player by default.

dktapps added 4 commits March 11, 2025 12:41
for now this is configured to warn only by default, until we get the parameters for it dialled in
@dktapps dktapps added Category: Network Related to the internal network architecture Type: Enhancement Contributes features or other improvements to PocketMine-MP labels Mar 12, 2025
@dktapps dktapps requested a review from a team as a code owner March 12, 2025 13:01
@dktapps dktapps changed the base branch from stable to minor-next March 12, 2025 13:01
@ShockedPlot7560
Copy link
Member

The system as described in the issue is OK for me as it permit server owner the ability to change the values.

But when I read pmmp/BinaryUtils@8cfa34c we are agree that some cost read/write ops are missing ? (like: strings, bytes, int) And that this PR is not ready to be merged in its current state?

@dktapps
Copy link
Member Author

dktapps commented Mar 22, 2025

The system as described in the issue is OK for me as it permit server owner the ability to change the values.

But when I read pmmp/BinaryUtils@8cfa34c we are agree that some cost read/write ops are missing ? (like: strings, bytes, int) And that this PR is not ready to be merged in its current state?

Fixed size types are accounted for in get(). String is 2 operations: getVarInt() and get(). It's not dependent on the size of the type but rather the number of calls needed to decode it.

@ShockedPlot7560
Copy link
Member

Right

@dktapps
Copy link
Member Author

dktapps commented Mar 22, 2025

I'm hung on this for now only because I'm not sure about the exact parameters to use for the accounting and limiting. May be necessary to just throw it into the wild to collect data.

@ShockedPlot7560
Copy link
Member

If we launch it into the wild, we'll need a way of determining whether the values are globally correct or whether, on the contrary, server owners are obliged to increase them all the time.

@dktapps
Copy link
Member Author

dktapps commented Mar 23, 2025

Yeah, well unfortunately I've found that server owners tend not to engage with experiments unless I just release them as stable and wait for people to start screaming.

@ShockedPlot7560
Copy link
Member

I can't test on my own with a large server. Could be a good idea to release it as stable and see what happened :/ (this sound very creepy).

@kostamax27
Copy link
Contributor

I can't test on my own with a large server. Could be a good idea to release it as stable and see what happened :/ (this sound very creepy).

later i will test it on 2 servers with about ~80 online on each

@kostamax27
Copy link
Contributor

I can't test on my own with a large server. Could be a good idea to release it as stable and see what happened :/ (this sound very creepy).

later i will test it on 2 servers with about ~80 online on each

so far I've noticed only one problem, it's the player's FPS

2025-03-24 [17:00:02.047] [Server thread/WARNING]: [NetworkSession: karikashka] Decoding InventoryTransactionPacket exceeded read ops budget! 94 > 33
2025-03-24 [17:00:04.463] [Server thread/WARNING]: [NetworkSession: kostamax27] Decoding InventoryTransactionPacket exceeded read ops budget! 94 > 31
2025-03-24 [17:00:06.053] [Server thread/WARNING]: [NetworkSession: kostamax27] Decoding InventoryTransactionPacket exceeded read ops budget! 94 > 68
2025-03-24 [17:00:06.657] [Server thread/WARNING]: [NetworkSession: kostamax27] Decoding InventoryTransactionPacket exceeded read ops budget! 94 > 60
2025-03-24 [17:00:07.965] [Server thread/WARNING]: [NetworkSession: kostamax27] Decoding InventoryTransactionPacket exceeded read ops budget! 94 > 4
2025-03-24 [17:00:08.710] [Server thread/WARNING]: [NetworkSession: kostamax27] Decoding InventoryTransactionPacket exceeded read ops budget! 94 > 28
2025-03-24 [17:00:10.360] [Server thread/WARNING]: [NetworkSession: karikashka] Decoding InventoryTransactionPacket exceeded read ops budget! 94 > 7
2025-03-24 [17:00:17.156] [Server thread/WARNING]: [NetworkSession: karikashka] Decoding InventoryTransactionPacket exceeded read ops budget! 94 > 11

but it's possible to "fix" it by simply increasing: session-budget-ticks and session-budget-per-tick

@ShockedPlot7560
Copy link
Member

thanks mojang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Network Related to the internal network architecture Type: Enhancement Contributes features or other improvements to PocketMine-MP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants