BentoBoxWorld / BentoBox

Expandable Minecraft server plugin for island-type games like SkyBlock or AcidIsland.
https://bentobox.world
Eclipse Public License 2.0
329 stars 137 forks source link

Bentobox massive lag spike during island removal due to IA custom blocks that do not exist #2297

Closed TheLaoming closed 4 months ago

TheLaoming commented 7 months ago

Expected behavior

It shouldn't lag like this. Version 1.24.1 didn't have this problem.

Observed/Actual behavior

When you invite someone and the chosen player already has his island, massive lag will start due to Itemsadder custom blocks (which are not even here). I'm not even use any custom blocks, there's literally that one AOneblock block.

Steps/models to reproduce

  1. Install Bentobox 1.20.0 or any dev build + Itemsadder
  2. Make any player to create their island
  3. Invite them
  4. 10 sec lag appears beacause of their island removal

BentoBox version

2.0.1-SNAPSHOT-b2557 with generated addons

Plugin list

Plugins (14): AnimatedScoreboard, BentoBox, Bentobox-AOneBlock, BentoBox-Biomes, BentoBox-Level, BentoBox-Visit, BentoBox-Warps, ItemsAdder, LoneLibs, LuckPerms, ProtocolLib, Vault, ViaBackwards, ViaVersion

Other

Using fork of paper Pufferfish 1.20.2, ItemsAdder 3.6.3-beta-5 and LoneLibs 1.0.43.

HSGamer commented 7 months ago

Use spark and provide us a spark report. It would be better for us to investigate the lag.

tastybento commented 7 months ago

Yes, the issue is that when the island is being deleted, the code tells ItemsAdder that the block is being removed, for each block. We had the same problem with SlimeFun, but I was able to fix it because their API has a way to check for blocks. I think I'll temporarily remove the hook so that there isn't lag at the expense of not deleting IA blocks.

tastybento commented 7 months ago

The other option is to drastically reduce the number of blocks deleted in one go in the BentoBox config.yml.

Anyway, I'll try and see if this can be optimized.

You can use the snapshot 2.0.1 version.

TheLaoming commented 7 months ago

Thanks! Does this also apply to IA furnitures too (especially those using armor stands) or just custom blocks?

HSGamer commented 7 months ago

Thanks! Does this also apply to IA furnitures too (especially those using armor stands) or just custom blocks?

Mostly just custom blocks

TheLaoming commented 7 months ago

I just tested dev build with disabled IA blocks removal, but for some reason it still lags but less than before. I don't remember this was a problem in 1.24.1. Maybe it's something wrong w 1.20.2 mc version? I was on 1.20.1 before. spark

tastybento commented 7 months ago

Try the very latest build on the CI server. I added NMS support for older versions - before, it would only optimize for 1.20.4, so if you were using 1.20.2, then it would be using the Bukkit API to copy and paste blocks.

tastybento commented 7 months ago

I asked the dev for some API addition to prevent the lag, but let's see. https://github.com/PluginBugs/Issues-ItemsAdder/issues/3445

TheLaoming commented 7 months ago

Great! Anyway don't know what's going on, I just updated Bentobox to the latest build and addons too, but there's lag when I invite a player. Looks like I have to stick with no island removal for now.

TheLaoming commented 7 months ago

Having same issue with purging unowned islands, because I just disabled automatic island removal. It's not really that massive, but probably same lag spike. So currently I have no way how to avoid this lag. Any idea @tastybento ? I've got lag when I purged just 4 islands.

tastybento commented 7 months ago

I need logs or stats to see where the lag is coming from when you do this. It may be some other location. Can you post a Spark report?

TheLaoming commented 7 months ago

Here it is, I think it's very similar when I am purging islands. https://spark.lucko.me/VdiF0IHFpV

tastybento commented 7 months ago

Hmm forgive me but that seems all okay - 20 tps across the board. Although BentoBox does use CPU, the TPS are not affected (at least according to that report). It looks like the staggering system is working. What do you actually experience in game?

TheLaoming commented 7 months ago

Trust me, it affects TPS too and it's really not a small lag spike, there is no chance not to notice, because you can't even open chests, drop items etc. drop drop2 Just check plugins section in that spark, 98% is crazy, never had more than 20 and it's even measured using a parameter --only-ticks-over 200 which is even more crazy.

tastybento commented 7 months ago

Okay thanks. Let's see what we can tweak.

TheLaoming commented 6 months ago

Same problem with 1.20.4, but looks like for example obadmin purge unowned doesn't lag like that, it only takes not even 1 tps. Problem is reset itself.