ChaoticTrials / SkyblockBuilder

Let you create a custom skyblock island via config
https://modrinth.com/mod/skyblock-builder
Apache License 2.0
9 stars 6 forks source link

Severe lag when players log into the server #183

Open Tollainmear opened 6 days ago

Tollainmear commented 6 days ago

Minecraft version

1.20.1

LibX version

1.20.1-5.0.14

Skyblock Builder version

1.20.1-5.1.22

Forge version

47.3.7

The latest.log file

https://gist.github.com/Tollainmear/fa0072632af6dccafef948852971d2d7

Issue description

When players enter the server, SkyBlockBuilder compares the ./world/data/skyblock_builder.dat file, causing severe server lag. After deleting this dat file, the lag issue is resolved. I have never modified this file. To facilitate your reproduction of this issue, I provide the automatically generated file in the server directory here.

data.zip

When only loading the SkyBlockBuilder mod, you can reproduce this issue, that is, every time a player logs into the server, the server's ticks decrease by 2/3, accompanied by specific log output No profile found for id.

Steps to reproduce

1.unzip the data.zip 2.copy skyblock_builder.dat to a Forge server, under the folder .world/data 3.start the server 4.Launch client then login and observe the server's TPS

Other information

I'm not sure if this is an issue related to the server or type of server-side. I haven't tested this issue in single-player games, and the server I use is Mohist.

Tollainmear commented 6 days ago

I'm not sure if the information I just provided is sufficient. If possible, please help me understand the possible reasons for this problem so I can better understand and provide more effective information. Thank you.

Tollainmear commented 1 day ago

@MelanX Hi, do you happen to have any ideas on how we might solve this problem?

MelanX commented 1 day ago

I totally forgot to answer, sorry! It looks like all the profiles are not official, like if you have an offline server and nobody owns the game. Because of that, all players in all teams will be searched and will not be cached. If this isn’t the case, it’s a bit weird. Then you could try if deleting the usercache.json (or very similar) file helps improving performance.

Tollainmear commented 9 hours ago

I totally forgot to answer, sorry! It looks like all the profiles are not official, like if you have an offline server and nobody owns the game. Because of that, all players in all teams will be searched and will not be cached. If this isn’t the case, it’s a bit weird. Then you could try if deleting the usercache.json (or very similar) file helps improving performance.

Yes, you are correct, my server is indeed an offline server. I tried to delete UserCache.json, but when players log in to the game, it still triggers very severe lag. Each time a player logs in, it causes the server to lag for about 5 seconds, and it happens so frequently that most players can't play the game normally.

MelanX commented 8 hours ago

Could you test with this file? It should not be required on the client side. SkyblockBuilder-1.20.1-5.1.23-test.zip

Here's what I changed:

Index: src/main/java/de/melanx/skyblockbuilder/util/RandomUtility.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/main/java/de/melanx/skyblockbuilder/util/RandomUtility.java b/src/main/java/de/melanx/skyblockbuilder/util/RandomUtility.java
--- a/src/main/java/de/melanx/skyblockbuilder/util/RandomUtility.java   (revision adca06e9845f37761b1252037a6202d9dcee1206)
+++ b/src/main/java/de/melanx/skyblockbuilder/util/RandomUtility.java   (date 1726234699990)
@@ -155,7 +155,7 @@
                 if (gameProfile.isPresent()) {
                     profiles.add(gameProfile.get());
                 } else {
-                    GameProfile profile = server.getSessionService().fillProfileProperties(new GameProfile(id, null), true);
+                    GameProfile profile = server.getSessionService().fillProfileProperties(new GameProfile(id, null), level.getServer().enforceSecureProfile());

                     if (profile.getName() != null) {
                         profileCache.add(profile);