Very big lag spikes when using PlaceholderAPI on the latest build from Artifacts or source code
Opened this issue · 6 comments
Type of bug
Performance loss or memory leak
TabList version
5.6.2 (latest artifact with JSON support)
Software version
Purpur-1614 (MC: 1.18.2)
Relevant plugins
PlaceholderAPI
Console error (if applicable)
There are no errors in the console.
TabList configuration files
It does not matter, the problem is present even with default configs.
Bug description
I started testing the plugin after you added JSON support to it and noticed that when 8 or more players join the server, very strange problems begin. TAB starts flickering as if the sorting is completely broken, players' nicknames randomly move through the list every tick. But besides this, very strong lags begin, TPS starts to drop up to 1-2, and sometimes the ping rises very much (despite the fact that I tested this on a local server, the ping rose to 7000 and above. :D). I went through all my plugins and found that the problem only appears when using the PlaceholderAPI. If you remove PAPI or disable its hook in config.yml, then the problem disappears.
(To replicate this issue without using live people, you can set online-mode to false and use the Minecraft Console Client to add the required number of players to the server https://github.com/MCCTeam/Minecraft-Console-Client)
Please include Spark and timings reports. Also maybe some gif or video for "flickering nicknames"
Edit: also try the newest build again
Please include Spark and timings reports. Also maybe some gif or video for "flickering nicknames"
Edit: also try the newest build again
Sorry for the late reply. I spent the whole day on the next tests to give you a cleaner answer, since yesterday I did not do it very objectively. And so, I tried various combinations of plugins and as it turned out, not only PlaceholderAPI is to blame for the lags.
I created a clean server on the latest build of Purpur with basic plugins: Vault, LuckPerms, spark and TabList with your latest fix. There were no problems with such a set of plugins, the server worked stably with any number of players.
Next, I added the PlaceholderAPI and this is where the first problems started to appear. When connecting 8 players, the ping starts to increase very much and after a while, the players are kicked from the server. But at this stage there are no problems with TPS, only ping.
Next, I added ProtocolLib and SuperVanish and connected 8 players to the server. At this stage, there were problems with TPS, but now there are no problems with ping.
If we now remove the PlaceholderAPI, but keep SuperVanish and ProtocolLib, then the problem disappears. There will be no problems with either ping or TPS.
The same will happen if you remove SuperVanish, but leave ProtocolLib (or vice versa, remove ProtocolLib but keep SuperVanish) and PlaceholderAPI, then there will also be no problems.
In other words:
• [Vault, LuckPerms, spark and TabList] + PlaceholderAPI = very high ping.
• [Vault, LuckPerms, spark and TabList] + PlaceholderAPI + ProtocolLib + SuperVanish = very low TPS but normal ping.
• [Vault, LuckPerms, spark and TabList] + ProtocolLib + SuperVanish = no problem.
• [Vault, LuckPerms, spark and TabList] + only ProtocolLib (or only SuperVanish) + PlaceholderAPI = no problem.
• If you remove TabList, then there are no problems with any combination of plugins.
It may sound complicated, strange and incomprehensible, but these are the results that I came to. And I have no idea why this is happening.
Here I recorded a video for you, where I demonstrate the problem of low TPS in the PlaceholderAPI + ProtocolLib + SuperVanish combination. As you can see in the video, the TPS starts dropping right after the 8th player connects. For a couple of seconds, you can also notice how the names of the players in the tab are randomly moved (when I said that the tab is blinking, I meant this). Sometimes such a chaotic movement lasts a few seconds, sometimes it may not stop at all. So far I have not figured out what it depends on. Usually such "blinking" of names starts when connecting/disconnecting players or when reloading the plugin. At the end, when I kick the 8th player, the TPS returns to normal.
Here is the Spark profiling result from this video: https://spark.lucko.me/oRUfO0vhw1
It looks like there are no more lags after this commit. Even sorting started to work, although before that I could not get it to work, users in TAB were always placed randomly.
But I can't confirm this for sure yet. I'll put it on a production server and see how it works on it and then I will answer about the result here.
Sorting of groups is still not works, #339 (I don't have any idea how to fix it, but sometimes works sometimes not)
Sorting of groups is still not works, #339 (I don't have any idea how to fix it, but sometimes works sometimes not)
This is sad, without sorting TAB looks worse... If it worked, then it would be generally wonderful.
Can you check how sorting is implemented in other plugins? For example in another plugin called "TAB" which is open source. Maybe this will give you some hint... I would really like to help you, but my programming skills are very poor. 😓