SkinsRestorer / SkinsRestorerX

SkinsRestorer development repository

Home Page:https://skinsrestorer.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Huge lag spikes when players join the server.

awgybop1 opened this issue · comments

Describe the bug

Whenever a player joins the server, a huge lag spike occurs.

A thread dump shows the following:
net.skinsrestorer.shared.utils.connections.MojangAPI.readURL(MojangAPI.java:290) net.skinsrestorer.shared.utils.connections.MojangAPI.readURL(MojangAPI.java:277) net.skinsrestorer.shared.utils.connections.MojangAPI.getProfileAshcon(MojangAPI.java:223) net.skinsrestorer.shared.utils.connections.MojangAPI.getSkin(MojangAPI.java:110) net.skinsrestorer.shared.storage.SkinStorage.getSkinForPlayer(SkinStorage.java:125) net.skinsrestorer.shared.storage.SkinStorage.getDefaultSkinForPlayer(SkinStorage.java:98) net.skinsrestorer.bukkit.listener.ProtocolLibJoinListener$1.onPacketSending(ProtocolLibJoinListener.java:70)

How can we reproduce what you got?

Create a Paper 1.16.5 server (not saying this is specifically the only version), install ProtocolLib and SkinsRestorer, and have players join the server.

Screenshots
If applicable, add screenshots to help explain your problem.

Server information

On what platform does your server run? (Bungeecord/Spigot/Bukkit) PaperSpigot

What version? Do NOT answer LATEST

  • SkinsRestorer: 14.1.9
  • Spigot version: 1.16.5
  • Bungeecord version: N/A
  • IF bungee, did you put the plugin on all servers: N/A
  • Plugins: If necessary, I can dump all of my plugins, but I don't think this is - read below:
  • Java: 16

Additional context

This can be found by enabling the "lag-helper" feature in ClearLagg and checking the Thread Dump.
This appears to be related to the Instant Skins feature that is auto-enabled whenever you have ProtocolLib installed.
By setting "DisableOnJoinSkins" to true in the config file, these lag spikes go away.
If it helps, I am utilizing ViaVersion 4.1.1 - I don't think this is a compatibility issue however, as I see there is a recent commit titled "Does making it async fix it?" which clearly edits the ProtocolLibOnJoin function.

commented

So am I
Whenever a player enters, the TPS will drop from 20 to about 18

plugin version

> sr status
[13:49:39 INFO]: ----------------------------------------------
[13:49:39 INFO]: Checking needed services for SR to work properly...
[13:49:43 INFO]: Working UUID API count: 3
[13:49:43 INFO]: Working Profile API count: 2
[13:49:43 INFO]: The plugin currently is in a working state.
[13:49:43 INFO]: ----------------------------------------------
[13:49:43 INFO]: SkinsRestorer v14.1.9
[13:49:43 INFO]: Server: git-Paper-66 (MC: 1.18)
[13:49:43 INFO]: BungeeMode: false
[13:49:43 INFO]: Finished checking services.
[13:49:43 INFO]: ----------------------------------------------

server version

> version
[13:51:34 INFO]: Checking version, please wait...
[13:51:35 INFO]: This server is running Paper version git-Paper-66 (MC: 1.18) (Implementing API version 1.18-R0.1-SNAPSHOT) (Git: dce79f3)
You are running the latest version
Previous version: git-Paper-64 (MC: 1.18)

some error (This error occurred in the dev version(v14.1.9) some time ago)

[13:39:23 ERROR]: --- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH  - git-Paper-66 (MC: 1.18) ---
[13:39:23 ERROR]: The server has not responded for 15 seconds! Creating thread dump
[13:39:23 ERROR]: ------------------------------
[13:39:23 ERROR]: Server thread dump (Look for plugins here before reporting to Paper!):
[13:39:23 ERROR]: Ticking entity: minecraft:player, entity class: net.minecraft.server.level.EntityPlayer
[13:39:23 ERROR]: Entity status: removed: false, valid: true, alive: true, is passenger: false
[13:39:23 ERROR]: Entity UUID: a35f6e1b-4faa-3ab2-a890-386423d38f3c
[13:39:23 ERROR]: Position: world: 'world' at location (7151.283692668159, 63.0, -6208.583409559092)
[13:39:23 ERROR]: Velocity: (0.0, 0.0, 0.0) (in blocks per tick)
[13:39:23 ERROR]: Entity AABB: AABB[7150.983692656238, 63.0, -6208.883409571013] -> [7151.58369268008, 64.79999995231628, -6208.283409547171]
[13:39:23 ERROR]: Total packets processed on the main thread for all players: 258061
[13:39:23 ERROR]: ------------------------------
[13:39:23 ERROR]: Current Thread: Server thread
[13:39:23 ERROR]:       PID: 25 | Suspended: false | Native: true | State: RUNNABLE
[13:39:23 ERROR]:       Stack:
[13:39:23 ERROR]:               java.base@17.0.1/sun.nio.ch.Net.poll(Native Method)
[13:39:23 ERROR]:               java.base@17.0.1/sun.nio.ch.NioSocketImpl.park(NioSocketImpl.java:181)
[13:39:23 ERROR]:               java.base@17.0.1/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:285)
[13:39:23 ERROR]:               java.base@17.0.1/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:309)
[13:39:23 ERROR]:               java.base@17.0.1/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
[13:39:23 ERROR]:               java.base@17.0.1/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
[13:39:23 ERROR]:               java.base@17.0.1/java.net.Socket$SocketInputStream.read(Socket.java:966)
[13:39:23 ERROR]:               java.base@17.0.1/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:478)
[13:39:23 ERROR]:               java.base@17.0.1/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472)
[13:39:23 ERROR]:               java.base@17.0.1/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:70)
[13:39:23 ERROR]:               java.base@17.0.1/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1455)
[13:39:23 ERROR]:               java.base@17.0.1/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:1059)
[13:39:23 ERROR]:               java.base@17.0.1/java.io.BufferedInputStream.fill(BufferedInputStream.java:244)
[13:39:23 ERROR]:               java.base@17.0.1/java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
[13:39:23 ERROR]:               java.base@17.0.1/java.io.BufferedInputStream.read(BufferedInputStream.java:343)
[13:39:23 ERROR]:               java.base@17.0.1/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:791)
[13:39:23 ERROR]:               java.base@17.0.1/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:726)
[13:39:23 ERROR]:               java.base@17.0.1/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1688)
[13:39:23 ERROR]:               java.base@17.0.1/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589)
[13:39:23 ERROR]:               java.base@17.0.1/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)
[13:39:23 ERROR]:               SkinsRestorer.jar//net.skinsrestorer.shared.utils.connections.MojangAPI.readURL(MojangAPI.java:290)
[13:39:23 ERROR]:               SkinsRestorer.jar//net.skinsrestorer.shared.utils.connections.MojangAPI.readURL(MojangAPI.java:277)
[13:39:23 ERROR]:               SkinsRestorer.jar//net.skinsrestorer.shared.utils.connections.MojangAPI.getProfileAshcon(MojangAPI.java:223)
[13:39:23 ERROR]:               SkinsRestorer.jar//net.skinsrestorer.shared.utils.connections.MojangAPI.getSkin(MojangAPI.java:110)
[13:39:23 ERROR]:               SkinsRestorer.jar//net.skinsrestorer.shared.storage.SkinStorage.getSkinForPlayer(SkinStorage.java:125)
[13:39:23 ERROR]:               SkinsRestorer.jar//net.skinsrestorer.shared.storage.SkinStorage.getDefaultSkinForPlayer(SkinStorage.java:98)
[13:39:23 ERROR]:               SkinsRestorer.jar//net.skinsrestorer.bukkit.listener.ProtocolLibJoinListener$1.onPacketSending(ProtocolLibJoinListener.java:70)
[13:39:23 ERROR]:               ProtocolLib.jar//com.comphenix.protocol.injector.SortedPacketListenerList.invokeSendingListener(SortedPacketListenerList.java:195)
[13:39:23 ERROR]:               ProtocolLib.jar//com.comphenix.protocol.injector.SortedPacketListenerList.invokePacketSending(SortedPacketListenerList.java:149)
[13:39:23 ERROR]:               ProtocolLib.jar//com.comphenix.protocol.injector.PacketFilterManager.handlePacket(PacketFilterManager.java:535)
[13:39:23 ERROR]:               ProtocolLib.jar//com.comphenix.protocol.injector.PacketFilterManager.invokePacketSending(PacketFilterManager.java:516)
[13:39:23 ERROR]:               ProtocolLib.jar//com.comphenix.protocol.injector.netty.ProtocolInjector.packetQueued(ProtocolInjector.java:346)
[13:39:23 ERROR]:               ProtocolLib.jar//com.comphenix.protocol.injector.netty.ProtocolInjector.onPacketSending(ProtocolInjector.java:308)
[13:39:23 ERROR]:               ProtocolLib.jar//com.comphenix.protocol.injector.netty.ChannelInjector.processSending(ChannelInjector.java:433)
[13:39:23 ERROR]:               ProtocolLib.jar//com.comphenix.protocol.injector.netty.ChannelInjector.access$800(ChannelInjector.java:70)
[13:39:23 ERROR]:               ProtocolLib.jar//com.comphenix.protocol.injector.netty.ChannelInjector$3.handleScheduled(ChannelInjector.java:373)
[13:39:23 ERROR]:               ProtocolLib.jar//com.comphenix.protocol.injector.netty.ChannelInjector$3.onMessageScheduled(ChannelInjector.java:343)
[13:39:23 ERROR]:               ProtocolLib.jar//com.comphenix.protocol.injector.netty.ChannelProxy$2.schedulingRunnable(ChannelProxy.java:127)
[13:39:23 ERROR]:               ProtocolLib.jar//com.comphenix.protocol.injector.netty.EventLoopProxy.execute(EventLoopProxy.java:95)
[13:39:23 ERROR]:               net.minecraft.network.Connection.writePacket(Connection.java:401)
[13:39:23 ERROR]:               net.minecraft.network.Connection.send(Connection.java:348)
[13:39:23 ERROR]:               net.minecraft.server.network.ServerGamePacketListenerImpl.send(ServerGamePacketListenerImpl.java:2002)
[13:39:23 ERROR]:               net.minecraft.server.network.ServerGamePacketListenerImpl.send(ServerGamePacketListenerImpl.java:1988)
[13:39:23 ERROR]:               net.minecraft.server.players.PlayerList.postChunkLoadJoin(PlayerList.java:389)
[13:39:23 ERROR]:               net.minecraft.server.players.PlayerList.lambda$placeNewPlayer$1(PlayerList.java:301)
[13:39:23 ERROR]:               net.minecraft.server.players.PlayerList$$Lambda$8846/0x000000080295b9e8.run(Unknown Source)
[13:39:23 ERROR]:               net.minecraft.server.network.ServerGamePacketListenerImpl.tick(ServerGamePacketListenerImpl.java:306)
[13:39:23 ERROR]:               net.minecraft.network.Connection.tick(Connection.java:526)
[13:39:23 ERROR]:               net.minecraft.server.network.ServerConnectionListener.tick(ServerConnectionListener.java:201)
[13:39:23 ERROR]:               net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1636)
[13:39:23 ERROR]:               net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:480)
[13:39:23 ERROR]:               net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1470)
[13:39:23 ERROR]:               net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1264)
[13:39:23 ERROR]:               net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317)
[13:39:23 ERROR]:               net.minecraft.server.MinecraftServer$$Lambda$3941/0x0000000801410f88.run(Unknown Source)
[13:39:23 ERROR]:               java.base@17.0.1/java.lang.Thread.run(Thread.java:833)
[13:39:23 ERROR]: ------------------------------
[13:39:23 ERROR]: --- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---
[13:39:23 ERROR]: ------------------------------

My quick and dirty fix was to set the "DisableOnJoinSkins" config option to true, and then wrote a quick command so that when a player joins, console runs the command "skin update ". (yeah, probably could hook the API, but I did say a dirty fix.)

Skins still work fine and the lag is gone.

commented

My quick and dirty fix was to set the "DisableOnJoinSkins" config option to true, and then wrote a quick command so that when a player joins, console runs the command "skin update ". (yeah, probably could hook the API, but I did say a dirty fix.)

Skins still work fine and the lag is gone.

I'll try

commented

My quick and dirty fix was to set the "DisableOnJoinSkins" config option to true, and then wrote a quick command so that when a player joins, console runs the command "skin update ". (yeah, probably could hook the API, but I did say a dirty fix.)

Skins still work fine and the lag is gone.

The solution is very effective, and the lag no longer appears

This issue has been resolved in build 14.1.10 - the ProtocolLib instant skins are now configurable and disabled by default, and as a result, this "bug" is fixed.

ezoic increase your site revenue