extreme performance hit with cluster randomspawns when no spaces are found
Summary
On a server with cluster random spawning enabled and a randomspawn in add mode, if a player moves in a way where there are no spawnable spaces (air above blocks > 12 block from the player) but still blocks in the spawning radius, the server MSPT goes to above 50 and the world starts to lag. we have tried this in a custom-built map without caves and replicated the issue on a clean server with minimal plugins an configuration. I can send the plugins folder and other config as a .zip if needed.
Steps to reproduce
- create a superflat server map (papermc 1.20.1-196) (MythicMobs version 5.6.2 premium)
server.properties (defaults omitted):
level-type=minecraft\:flat
spawn-protection=0
plugins/MythicMobs/config/config-spawning.yml (defaults omitted):
# (defaults)
RandomSpawning:
# Generator used for ADD method. Can be NONE, CLUSTER, or LEGACY
Generator: CLUSTER
# (defaults)
(make sure to restart the server so the config change takes effect)
- create a random spwaner with a config like the following
spawner:
Cooldown: 0
Type: test
Chance: 0 # also tested with 0.1, same behavior
Action: ADD
Worlds: world
PositionType: LAND
the mob has this config:
test:
Type: ZOMBIE
Display: Zombie
- use worldedit or similar to create a 200x200x200 cube of any solid block (tested with stone)
- use spectator mode to fly to the middle of the cube or mine in >12 blocks from the top
- watch the server MSPT go up (using TabTps)
Current behavior
the MSPT goes up to 50
Intended correct behavior
the MSPT should stay at a normal level
Server log file
Debug log snippet
!! The MSPT is not as high, but still higher than usual when using debug level 9 (any lower level does not show any console output and don not affect MSPT)
Proposed fixes
Mythic might be looping endlessly trying to find spawning spaces since there are some solid blocks, make sure this loop ends somehow.