spoorn / myLoot

Instanced loot chests for Minecraft Fabric
Other
4 stars 6 forks source link

[1.18.2] Crashing in Server #22

Closed itsdinkd closed 2 years ago

itsdinkd commented 2 years ago

Noticed this crash log in AQM2's official server. Can't really give much details as it wasn't reported to me, just saw it happened a few times in the crash reports folder.

https://pastebin.com/n1tSyCLh

spoorn commented 2 years ago

Interesting, let's break this down:

  1. A player opened a myLoot chest -> ChestBlock.onUse
  2. This triggers loot to be generated for the chest, and it looks like the server has enableRandomSeedLootPerPlayer = true so it generates new random loot for the player -> generateRandomLoot
  3. One of the items that was generated is an Explorer Map -> ExplorationMapLootFunction
  4. This triggers a locate command for a Jigsaw structure -> ChunkGenerator.locateStructure and JigsawFeature.method_38676
  5. This then triggers generation of the structure and the chunk(s) it's in -> StructurePoolBasedGenerator.generate
  6. This generation takes too long and it triggers Watchdog to timeout (default 60 seconds, or whatever you set max-tick-time to in server.properties) -> java.lang.Error: Watchdog

It looks like there have been other reports of Explorer Maps causing timeouts, but that's when Optifine or generate-structures=false in server.properties: https://bugs.mojang.com/browse/MC-126244, https://bugs.mojang.com/browse/MC-130449

Do you know if either of those cases apply to you?

Step (2) where myLoot generates new random loot for the player is the same code as vanilla, and invoked the same way - when the player opens the inventory that should generate loot i.e. the ChestBlock.

I'm thinking some structure, or the worldgen for the chunks the structure is in is taking too long to generate causing the timeout.

Any chance you could fetch the world seed and modpack version you're using so I can see if I can reproduce it?

Unfortunately from the logs, I can't figure out which structure it's trying to locate - which might be the issue. I'll also look into whether there's a way for myLoot to skip or generate this in a different way so it doesn't hang the server thread

spoorn commented 2 years ago

I actually found a similar crash report in my own server for this as well, only happened one time for me though. It's the same issue where it generates loot one of which is the Explorer Map, and triggers structure /locate which times out.

In my case though, this is purely the vanilla checkLootInteraction (MyLootChestBlockEntity just calls the vanilla checkLootInteraction), where it's the very first time the loot is generated for the ChestBlock, so it doesn't run through the myLoot random loot generation per player. This makes me highly suspect it's because Explorer Maps trigger locate and structure/chunk generation which can be especially slow in heavily modded worlds. I'll try to reproduce it still

crash-reports_crash-2022-07-19_10.42.44-server.txt

spoorn commented 2 years ago

Do you have terralith installed?

spoorn commented 2 years ago

I was able to reproduce this and found out the Explorer Map turns into a Terralith Traveler's Map which has known issues with timing out: https://www.curseforge.com/minecraft/mc-mods/terralith?comment=918

image

And from the Terralith Discord:

image

Here are the commands for easy copy-pasting:

/scoreboard objectives add tr.disable_maps dummy
/scoreboard players set %DISABLE_MAP tr.disable_maps 1

/loot give @p loot terralith:random_traveler_map

The Traveler's map generates a dummy structure in some biome, to create a map that can locate a Biome - which is why the original crash report showed it was trying to locate a structure and generating the Biome/Chunk it's in.

I was able to reproduce this issue using my own crash report to generate the same world. Running those commands to disable Terralith Traveler's Maps fixed the issue.

In summary, this issue is unrelated to myLoot and is due to the Terralith Traveler's Map which can be disabled using the commands above. Let me know if after running those commands, there's still an issue you see related to myLoot

spoorn commented 2 years ago

@itsdinkd

If it helps, I have a mod that allows you to trigger commands on server startup which you could add those /scoreboard commands to: https://www.curseforge.com/minecraft/mc-mods/starter-items

I needed this for my own modpack

itsdinkd commented 1 year ago

Shiiiiiet i never saw this! im getting a lot of these crashes lately. nice okay I'm going to add that scoreboard now.

itsdinkd commented 1 year ago

also @spoorn I have several different watchdog crashes that involve MyLoot. CAn I send them your way?

spoorn commented 1 year ago

also @spoorn I have several different watchdog crashes that involve MyLoot. CAn I send them your way?

sure

itsdinkd commented 1 year ago

also @spoorn I have several different watchdog crashes that involve MyLoot. CAn I send them your way?

sure

https://mclo.gs/GKCLiWX https://mclo.gs/moRAP4h https://mclo.gs/MLgN9Tz

itsdinkd commented 1 year ago

that is 1.19.2 btw