DutchJelly / CraftEnhance

A Minecraft Plugin that allows server owners to create custom recipes in-game
Apache License 2.0
13 stars 10 forks source link

PacketTooLarge problem 1.16.5 #56

Open Mr-VEPRb opened 10 months ago

Mr-VEPRb commented 10 months ago

Describe the bug If too many crafts are created in the plugin (more than 220), players cannot connect to the server with the following error: % test lost connection: Internal Exception: net.minecraft.server.v1_16_R3.PacketEncoder$PacketTooLargeException: PacketTooLarge - PacketPlayOutRecipeUpdate is 2245575. Max is 2097152 %

To Reproduce Steps to reproduce the behavior:

  1. create as much recipes as you can
  2. restart server
  3. try to log in
  4. See error

Show console logs

Logs for starting server (consists no errors): [12:21:58] [Server thread/INFO]: [CraftEnhance] Enabling CraftEnhance v2.5.5 [12:21:58] [Server thread/INFO]: [CraftEnhance] Now starting MenuApi. Any errors will be shown below. [12:21:58] [Server thread/INFO]: [NBTAPI] [NBTAPI] NMS support 'MC1_16_R3' loaded! [12:21:58] [Server thread/INFO]: [NBTAPI] [NBTAPI] Found Gson: class com.google.gson.Gson [12:21:58] [Thread-8/WARN]: [NBTAPI] [NBTAPI] The NBT-API located at 'package menulibrary.menulib.dependencies.nbt.nbtapi' seems to be outdated! [12:21:58] [Thread-8/WARN]: [NBTAPI] [NBTAPI] Current Version: '2.11.1' Newest Version: 2.11.3' [12:21:58] [Thread-8/WARN]: [NBTAPI] [NBTAPI] Please update the NBTAPI or the plugin that contains the api(nag the mod author when the newest release has an old version, not the NBTAPI dev)! [12:22:02] [Server thread/INFO]: [CraftEnhance] CraftEnhance is managed and developed by DutchJelly. [12:22:02] [Server thread/INFO]: [CraftEnhance] If you find a bug in the plugin, please report it to https://github.com/DutchJelly/CraftEnhance/issues. [12:22:02] [Server thread/INFO]: [CraftEnhance] Running a version check to check that the server is compatible with game version 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19. [12:22:02] [Server thread/INFO]: [CraftEnhance] The correct version is installed.

broken1arrow commented 10 months ago

Describe the bug If too many crafts are created in the plugin (more than 220), players cannot connect to the server with the following error: % test lost connection: Internal Exception: net.minecraft.server.v1_16_R3.PacketEncoder$PacketTooLargeException: PacketTooLarge - PacketPlayOutRecipeUpdate is 2245575. Max is 2097152 %

To Reproduce Steps to reproduce the behavior:

1. create as much recipes as you can

2. restart server

3. try to log in

4. See error

Show console logs

Logs for starting server (consists no errors): [12:21:58] [Server thread/INFO]: [CraftEnhance] Enabling CraftEnhance v2.5.5 [12:21:58] [Server thread/INFO]: [CraftEnhance] Now starting MenuApi. Any errors will be shown below. [12:21:58] [Server thread/INFO]: [NBTAPI] [NBTAPI] NMS support 'MC1_16_R3' loaded! [12:21:58] [Server thread/INFO]: [NBTAPI] [NBTAPI] Found Gson: class com.google.gson.Gson [12:21:58] [Thread-8/WARN]: [NBTAPI] [NBTAPI] The NBT-API located at 'package menulibrary.menulib.dependencies.nbt.nbtapi' seems to be outdated! [12:21:58] [Thread-8/WARN]: [NBTAPI] [NBTAPI] Current Version: '2.11.1' Newest Version: 2.11.3' [12:21:58] [Thread-8/WARN]: [NBTAPI] [NBTAPI] Please update the NBTAPI or the plugin that contains the api(nag the mod author when the newest release has an old version, not the NBTAPI dev)! [12:22:02] [Server thread/INFO]: [CraftEnhance] CraftEnhance is managed and developed by DutchJelly. [12:22:02] [Server thread/INFO]: [CraftEnhance] If you find a bug in the plugin, please report it to https://github.com/DutchJelly/CraftEnhance/issues. [12:22:02] [Server thread/INFO]: [CraftEnhance] Running a version check to check that the server is compatible with game version 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19. [12:22:02] [Server thread/INFO]: [CraftEnhance] The correct version is installed.

I think it is more server limit. But can you try latest version and see if you get same problem?

Mr-VEPRb commented 10 months ago

I tried latest version and nothing changed. I also tried to find any solution but there was no mention of server restrictions anywhere.

broken1arrow commented 10 months ago

I tried latest version and nothing changed. I also tried to find any solution but there was no mention of server restrictions anywhere.

can you post latest stack trace or is it same also? I can tell you not always is the limits described at all, so you have to work blindfolded some times.

Mr-VEPRb commented 10 months ago

Uts fully the same.

Mr-VEPRb commented 10 months ago

And I found interesting bug: when i remove some recipes to reduce packets amounts, they on the contrary increase: PacketPlayOutRecipeUpdate is 2245575 (default) PacketPlayOutRecipeUpdate is 6943290 (after removing recipes)

If I restart my server again, the amount of packets return to the first value

broken1arrow commented 10 months ago

And I found interesting bug: when i remove some recipes to reduce packets amounts, they on the contrary increase: PacketPlayOutRecipeUpdate is 2245575 (default) PacketPlayOutRecipeUpdate is 6943290 (after removing recipes)

If I restart my server again, the amount of packets return to the first value

Alright, yeah I think the increase is because you not remove from client. Could you send your recipe.yml and item.yml? I guess you have a lot of metadata on the items.

Mr-VEPRb commented 10 months ago

ceh.zip

broken1arrow commented 10 months ago

ceh.zip

Alright, you seem to have a huge amount of items with extensive lore, and you've also set up over 200 recipes. My assumption is that you have 'learn recipe' set to true also?

It's possible that the server is struggling to send such large packets and ends up kicking the client. Unfortunately, it seems I can't directly resolve this issue beyond limiting the number of recipes you can create. I consulted some experts about this problem, and it turns out you can't add an unlimited number of recipes due to packet size limitations.

The situation might improve in upcoming Minecraft updates, possibly after 1.20.1 or 1.21, as they might allow for larger packets. However, there will still be a limit.

At this point, one possible solution could be trying to turn off the 'learn recipe' feature. Keep in mind that the knowledge book might not function properly anyway when you're using custom data on your items. This might add a bit more work for your players, but once they've done it once, the right ingredients will be saved. However, please note that the recipe will be removed when a player rejoins the server.

Mr-VEPRb commented 9 months ago

The feature "learn recipe" was never enabled, but it didn't help. I started crafting anew, but another problem arose: half of the recipes works properly, while the others does not (no result in my workbench). At the same time, I don't see any error in the console

broken1arrow commented 9 months ago

The feature "learn recipe" was never enabled, but it didn't help. I started crafting anew, but another problem arose: half of the recipes works properly, while the others does not (no result in my workbench). At the same time, I don't see any error in the console

Alright I can't do so much about the error.

Have you update to latest? This one 2.5.9.1.5?