NiklasEi / gamebox

Minecraft plugin with a vast selection of inventory games
http://gamebox.nikl.me
GNU General Public License v3.0
16 stars 13 forks source link

gamebox held up server on startup #56

Closed hafarooki closed 4 years ago

hafarooki commented 5 years ago
"Server thread" #21 prio=5 os_prio=0 cpu=24182.58ms elapsed=79.42s tid=0x00007fc34dc59000 nid=0x30b1 waiting on condition  [0x00007fc2dd6c9000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
    at java.lang.Thread.sleep(java.base@11/Native Method)
    at com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository.findProfilesByNames(YggdrasilGameProfileRepository.java:85)
    at com.destroystokyo.paper.profile.PaperGameProfileRepository.findProfilesByNames(PaperGameProfileRepository.java:45)
    at net.minecraft.server.v1_12_R1.TileEntitySkull$1.load(TileEntitySkull.java:64)
    at net.minecraft.server.v1_12_R1.TileEntitySkull$1.load(TileEntitySkull.java:46)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3716)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2424)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2298)
    - locked <0x00000007cb048de8> (a com.google.common.cache.LocalCache$StrongAccessEntry)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2211)
    at com.google.common.cache.LocalCache.get(LocalCache.java:4154)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4158)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5147)
    at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5153)
    at net.minecraft.server.v1_12_R1.TileEntitySkull$3.call(TileEntitySkull.java:206)
    at net.minecraft.server.v1_12_R1.TileEntitySkull$3.call(TileEntitySkull.java:203)
    at net.minecraft.server.v1_12_R1.TileEntitySkull.b(TileEntitySkull.java:222)
    at org.bukkit.craftbukkit.v1_12_R1.inventory.CraftMetaSkull.applyToItem(CraftMetaSkull.java:86)
    at org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack.setItemMeta(CraftItemStack.java:389)
    at org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack.asNMSCopy(CraftItemStack.java:46)
    at org.bukkit.craftbukkit.v1_12_R1.inventory.CraftInventory.setItem(CraftInventory.java:96)
    at me.nikl.gamebox.utility.ItemStackUtility.getPlayerHead(ItemStackUtility.java:109)
    at me.nikl.gamebox.inventory.gui.game.TopListPage.update(TopListPage.java:69)
    at me.nikl.gamebox.data.toplist.TopList.updateUsers(TopList.java:70)
    at me.nikl.gamebox.data.toplist.TopList.updatePlayerScores(TopList.java:42)
    at me.nikl.gamebox.data.database.FileDB$2.onSuccess(FileDB.java:139)
    at me.nikl.gamebox.data.database.FileDB$2.onSuccess(FileDB.java:136)
    at me.nikl.gamebox.data.database.FileDB$3$1.run(FileDB.java:254)
    at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:63)
    at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:423)
    at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:840)
    at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:423)
    at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:774)
    at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:666)
    at java.lang.Thread.run(java.base@11/Thread.java:834)

above stacktrace is from jstack. I was doing some mass UUID -> name conversion so mojang's probably limiting my connections, that's probably it

NiklasEi commented 5 years ago

above stacktrace is from jstack. I was doing some mass UUID -> name conversion so mojang's probably limiting my connections, that's probably it

Either that or maybe the connection just timed out. From your stacktrace I would say that this is nothing I can do about in GameBox.

hafarooki commented 5 years ago

I had this issue again several times, why is it loading people's profiles on the main thread?

NiklasEi commented 5 years ago

I'll reopen and see when I find time to add this. I should rewrite the way GameBox loads the top lists anyway (#34).

hafarooki commented 5 years ago

thanks :smile:

hafarooki commented 5 years ago

There are lots of sites that cache the skin, you might want to see if you can use this instead, I think Crafatar works for that

hafarooki commented 5 years ago

as a temporary solution, can this be disabled? It's holding it up every startup now :confused:

NiklasEi commented 5 years ago

As a temporary "fix" you could remove the top lists. Go to the game configurations and comment out the toplists. This way you won't lose the statistics, but the plugin won't load the heads.

Matocolotoe commented 5 years ago

Heads could just be loaded in another thread nah ?

NiklasEi commented 5 years ago

Only the call for the texture is the problem. And yes, sure I can do that on another thread. That's what Miclebrick already said.

I will do this together with #61

RoboMWM commented 5 years ago

That, or get the profile async. Then the server won't do a synchronous call for the texture when you retrieve the head. But that's a paper-only thing (getting the profile) iirc.

NiklasEi commented 5 years ago

As far as I know I can just cache the textures as string, and use fake GameProfiles to apply them to heads. That should work for Bukkit. It just needs the authlib from mojang.

NiklasEi commented 4 years ago

Closing in favour of #61