Dungeon Difficulty

Dungeon Difficulty

3M Downloads

[1.20.1] Server freeze / timeout when loading specific chunk region (caused by dungeon\_difficulty structure checks)

RockZe opened this issue · 2 comments

commented

Hello, I have a reproducible server freeze related to dungeon_difficulty.
Environment: Fabric 1.20.1, ~450 mods, multiplayer server (30–40 players).

Problem

  • When any player approaches chunk region (-180,64) to (-162,68) the server completely freezes and disconnects clients with a timeout.
  • Deleting entities and tile entities in these chunks with MCA Selector does not solve the issue.
  • Even deleting and regenerating the chunks still reproduces the problem.

Diagnostics

  • Running /spark profiler --timeout 60 during the freeze shows the main thread blocked in dungeon_difficulty logic.

  • The stacktrace points to structure pattern matching: calls into net.minecraft.server.level.ServerChunkCache / ChunkMap and dungeon_difficulty structure scanning.

  • Example excerpt from the captured stack:

    java.lang.Thread.run
     net.minecraft.server.MinecraftServer.tickChildren
     net.minecraft.server.level.ServerChunkCache.getChunk
     net.minecraft.server.level.ChunkMap.getChunk
     net.minecraft.world.level.chunk.ChunkStatus.generate
     modernfix.structure.CachingStructureManager.readStructureTag
     dungeon_difficulty.structure.StructureDifficultyHandler.matchStructures
     dungeon_difficulty.structure.StructureDifficultyHandler.updateChunkDifficulty
    
  • Disabling the mod dungeon_difficulty immediately resolves the freeze; the region becomes playable again.

  • Other structure mods present (BetterDungeons, BetterMineshafts, BetterStrongholds, RespawningStructures, etc.), but only dungeon_difficulty consistently triggers the lockup.

Config

Even with a stock config (dungeon_difficulty_v2.json), the issue persists. Customizing values (perPlayerDifficulty, entity matchers, zones) does not change behavior — the server still freezes as soon as dungeon_difficulty is active.

Expected

Dungeon Difficulty should not hard-freeze the server during chunk load. At worst, it should skip invalid or unexpected structure data.

Request

Could you please investigate:

  • Why structure scanning in dungeon_difficulty hangs indefinitely in certain regions?
  • Is there a way to disable structure-based difficulty logic entirely, and only use per-dimension or per-player scaling?
  • Could the structure matcher run asynchronously or with a timeout, so it cannot lock up the main server thread?

Thanks for your work — this mod is very useful for RPG balancing, but this bug makes some areas of the world completely unplayable.

commented

From personal observation, downloading regions through chunky with Dungeon Difficulty is almost 2 times slower than without it.

On average:

With Dungeon Difficulty - Rate: 2.3 cps

Without Dungeon Difficulty - Rate: 5.2 cps

Maybe it's because of my configuration, I'll attach it below. I tried to make the most hardcore enhancements, but maybe I went a little overboard :)

dungeon_difficulty_v2.json

commented

Hello,

The 1.20.1 version is archived, players can use it as is.

I recommend updating to 1.21.1 where this mod (and the whole ecosystem) works much better. :)