Open AngryCarrot789 opened 2 years ago
I seem to have fixed it by modifying the UniqueIdQuery
and Query
classes, by changing how it treats returned usernames:
if (this.useCache) {
String username = SpongeUsernameCache.getLastKnownUsername(this.uniqueId);
if (username != null || SpongeUsernameCache.containsUUID(this.uniqueId)) {
return GameProfile.of(this.uniqueId, username);
}
}
The first time the code runs, the username will be null and the call to containsUUID
will return false, causing a lookup. But that will allow the UUID to be cached with a null username, meaning a call to containsUUID
returns true
Not sure if this will break sponge in any way, but at least now the server is playable
Version
7.0.0
Operating System
Linux/ubuntu
Java Version
1.8.0_312
Plugins/Mods
Describe the bug
A plugin i have called
GriefDefender
listens to block collisions, and sometimes block collisions seem to get called extremely often. Griefdefender checks permissions during a collision, which checks LuckPerms, which needs to get a player'sGameProfile
instance viaSponge.getServer().getGameProfileManager().get(UUID)
, which invokesSpongeProfileManager.get(UUID, useCache)
After looking at the source for
SpongeProfileManager
, i saw that theget(UUID, useCache)
method always submits an async task and has to wait for a result. The problem is that block collisions are usually processed on the server thread, which means it obviously halts the server thread until the async executor finishes the task, which in my case causes the server TPS drops to around 2~ TPS. Disabling collision checks in GriefDefender fixed this problemI'm not sure if block collisions are supposed to be called this often, in which case i've narrowed the issue down to Biomes O' plenty's grass; standing between shortgrass and medium grass (where you collide with both bounding boxes) appears to cause collisions to constantly be fired, causing this huge amount of lag. I'm not really sure if this is entirely a SpongeForge issue, or a GriefDefender/Biomes O' Plenty problem
This is a screenshot of what i captured in VisualVM:
Link to logs
No response
Edit: After recompiling
SpongeProfileManager
so thatsubmitTask
invokes the callable parameter directly, it seems like the server thread is stuck waiting here:For some reason, the UUID fetch result isn't being cached. And looking at the
UniqueIdQuery
, after the lookup is complete, if thegameProfiles
list returned is empty, it returns i think an empty game profile, but it never caches that UUID as the empty profile, which i assume means that every lookup for that UUID is checked in the mojang database, maybe?