Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using OfflinePlayer as a param causes my server to crash sometimes #391

Open
malafk opened this issue May 8, 2023 · 1 comment
Open

Comments

@malafk
Copy link

malafk commented May 8, 2023

Hello, I am using ACF in one of my plugins which is on a server with java and bedrock players.. When running a command it sometimes crashes. Here is my code

Using implementation "co.aikar:acf-paper:0.5.1-SNAPSHOT"

    @Subcommand("run")
    @CommandPermission("quests.admin")
    public void runQuest(CommandSender sender, @Name("target") OfflinePlayer target, @Name("quest") String quest) {
        if (!(sender instanceof Player)) {
            if(plugin.villagerManager.getQuestByName(quest) == null) {
                sender.sendMessage(ChatColor.RED + " Invalid quest provided " + quest);
                return;
            }
            plugin.villagerManager.playVillager((Player) target, quest, plugin.playerManager.hasCompletedQuestOrTask((Player) target, quest, PlayerManager.QuestOrTask.QUEST));
        } else {
            sender.sendMessage(ChatColor.RED + "This command can only be executed from the console.");
        }
    }

Here is my crash log

[18:51:21 ERROR]: --- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH  - git-Pufferfish-65 (MC: 1.19.4) ---
[18:51:21 ERROR]: The server has not responded for 35 seconds! Creating thread dump
[18:51:21 ERROR]: ------------------------------
[18:51:21 ERROR]: Server thread dump (Look for plugins here before reporting to Paper!):
[18:51:21 ERROR]: Ticking entity: minecraft:player, entity class: net.minecraft.server.level.EntityPlayer
[18:51:21 ERROR]: Entity status: removed: false, valid: true, alive: true, is passenger: false
[18:51:21 ERROR]: Entity UUID: 00000000-0000-0000-0009-01f66c1d949f
[18:51:21 ERROR]: Position: world: 'spawn' at location (11.366033, 65.0, -6.9089375)
[18:51:21 ERROR]: Velocity: (0.0, -0.0784000015258789, 0.0) (in blocks per tick)
[18:51:21 ERROR]: Entity AABB: AABB[11.06603298807907, 65.0, -7.208937511920929] -> [11.666033011920929, 66.79999995231628, -6.608937488079071]
[18:51:21 ERROR]: Total packets processed on the main thread for all players: 36926976
[18:51:21 ERROR]: ------------------------------
[18:51:21 ERROR]: Current Thread: Server thread
[18:51:21 ERROR]:       PID: 28 | Suspended: false | Native: true | State: RUNNABLE
[18:51:21 ERROR]:       Stack:
[18:51:21 ERROR]:               java.base@17.0.7/sun.nio.ch.Net.poll(Native Method)
[18:51:21 ERROR]:               java.base@17.0.7/sun.nio.ch.NioSocketImpl.park(NioSocketImpl.java:181)
[18:51:21 ERROR]:               java.base@17.0.7/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:285)
[18:51:21 ERROR]:               java.base@17.0.7/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:309)
[18:51:21 ERROR]:               java.base@17.0.7/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
[18:51:21 ERROR]:               java.base@17.0.7/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
[18:51:21 ERROR]:               java.base@17.0.7/java.net.Socket$SocketInputStream.read(Socket.java:966)
[18:51:21 ERROR]:               java.base@17.0.7/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:484)
[18:51:21 ERROR]:               java.base@17.0.7/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:478)
[18:51:21 ERROR]:               java.base@17.0.7/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160)
[18:51:21 ERROR]:               java.base@17.0.7/sun.security.ssl.SSLTransport.decode(SSLTransport.java:111)
[18:51:21 ERROR]:               java.base@17.0.7/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1510)
[18:51:21 ERROR]:               java.base@17.0.7/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1425)
[18:51:21 ERROR]:               java.base@17.0.7/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:455)
[18:51:21 ERROR]:               java.base@17.0.7/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:426)
[18:51:21 ERROR]:               java.base@17.0.7/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:589)
[18:51:21 ERROR]:               java.base@17.0.7/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:187)
[18:51:21 ERROR]:               java.base@17.0.7/sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1430)
[18:51:21 ERROR]:               java.base@17.0.7/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1401)
[18:51:21 ERROR]:               java.base@17.0.7/sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:220)
[18:51:21 ERROR]:               com.mojang.authlib.HttpAuthenticationService.performPostRequest(HttpAuthenticationService.java:78)
[18:51:21 ERROR]:               com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:111)
[18:51:21 ERROR]:               com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:106)
[18:51:21 ERROR]:               com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository.findProfilesByNames(YggdrasilGameProfileRepository.java:56)
[18:51:21 ERROR]:               com.destroystokyo.paper.profile.PaperGameProfileRepository.findProfilesByNames(PaperGameProfileRepository.java:44)
[18:51:21 ERROR]:               net.minecraft.server.players.GameProfileCache.lookupGameProfile(GameProfileCache.java:110)
[18:51:21 ERROR]:               net.minecraft.server.players.GameProfileCache.get(GameProfileCache.java:181)
[18:51:21 ERROR]:               org.bukkit.craftbukkit.v1_19_R3.CraftServer.getOfflinePlayer(CraftServer.java:1833)
[18:51:21 ERROR]:               org.bukkit.Bukkit.getOfflinePlayer(Bukkit.java:1262)
[18:51:21 ERROR]:               Minebuddiesquests-1.0-SNAPSHOT-all.jar//lol.maltest.minebuddiesquests.acf.BukkitCommandContexts.lambda$new$5(BukkitCommandContexts.java:145)
[18:51:21 ERROR]:               Minebuddiesquests-1.0-SNAPSHOT-all.jar//lol.maltest.minebuddiesquests.acf.BukkitCommandContexts$$Lambda$9753/0x0000000802d259f8.getContext(Unknown Source)
[18:51:21 ERROR]:               Minebuddiesquests-1.0-SNAPSHOT-all.jar//lol.maltest.minebuddiesquests.acf.RegisteredCommand.resolveContexts(RegisteredCommand.java:290)
[18:51:21 ERROR]:               Minebuddiesquests-1.0-SNAPSHOT-all.jar//lol.maltest.minebuddiesquests.acf.RegisteredCommand.resolveContexts(RegisteredCommand.java:212)
[18:51:21 ERROR]:               Minebuddiesquests-1.0-SNAPSHOT-all.jar//lol.maltest.minebuddiesquests.acf.RegisteredCommand.invoke(RegisteredCommand.java:149)
[18:51:21 ERROR]:               Minebuddiesquests-1.0-SNAPSHOT-all.jar//lol.maltest.minebuddiesquests.acf.BaseCommand.executeCommand(BaseCommand.java:578)
[18:51:21 ERROR]:               Minebuddiesquests-1.0-SNAPSHOT-all.jar//lol.maltest.minebuddiesquests.acf.BaseCommand.execute(BaseCommand.java:513)
[18:51:21 ERROR]:               Minebuddiesquests-1.0-SNAPSHOT-all.jar//lol.maltest.minebuddiesquests.acf.RootCommand.execute(RootCommand.java:99)
[18:51:21 ERROR]:               Minebuddiesquests-1.0-SNAPSHOT-all.jar//lol.maltest.minebuddiesquests.acf.BukkitRootCommand.execute(BukkitRootCommand.java:84)
[18:51:21 ERROR]:               org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155)
[18:51:21 ERROR]:               org.bukkit.craftbukkit.v1_19_R3.CraftServer.dispatchCommand(CraftServer.java:906)
[18:51:21 ERROR]:               Citizens (1).jar//net.citizensnpcs.util.Util.runCommand(Util.java:371)
[18:51:21 ERROR]:               Citizens (1).jar//net.citizensnpcs.trait.CommandTrait$NPCCommand.run(CommandTrait.java:536)
[18:51:21 ERROR]:               Citizens (1).jar//net.citizensnpcs.trait.CommandTrait$1.lambda$runCommand$2(CommandTrait.java:306)
[18:51:21 ERROR]:               Citizens (1).jar//net.citizensnpcs.trait.CommandTrait$1$$Lambda$12388/0x0000000803271a28.run(Unknown Source)
[18:51:21 ERROR]:               Citizens (1).jar//net.citizensnpcs.trait.CommandTrait$1.runCommand(CommandTrait.java:310)
[18:51:21 ERROR]:               Citizens (1).jar//net.citizensnpcs.trait.CommandTrait$1.run(CommandTrait.java:270)
[18:51:21 ERROR]:               Citizens (1).jar//net.citizensnpcs.trait.CommandTrait.dispatch(CommandTrait.java:317)
[18:51:21 ERROR]:               Citizens (1).jar//net.citizensnpcs.EventListen.onPlayerInteractEntity(EventListen.java:451)
[18:51:21 ERROR]:               com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor348.execute(Unknown Source)
[18:51:21 ERROR]:               org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77)
[18:51:21 ERROR]:               co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:77)
[18:51:21 ERROR]:               org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70)
[18:51:21 ERROR]:               io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54)
[18:51:21 ERROR]:               io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126)
[18:51:21 ERROR]:               org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:617)
[18:51:21 ERROR]:               net.minecraft.server.network.ServerGamePacketListenerImpl$5.performInteraction(ServerGamePacketListenerImpl.java:2802)
[18:51:21 ERROR]:               net.minecraft.server.network.ServerGamePacketListenerImpl$5.a(ServerGamePacketListenerImpl.java:2850)
[18:51:21 ERROR]:               net.minecraft.network.protocol.game.ServerboundInteractPacket$InteractionAction.dispatch(ServerboundInteractPacket.java:131)
[18:51:21 ERROR]:               net.minecraft.network.protocol.game.ServerboundInteractPacket.dispatch(ServerboundInteractPacket.java:80)
[18:51:21 ERROR]:               net.minecraft.server.network.ServerGamePacketListenerImpl.handleInteract(ServerGamePacketListenerImpl.java:2791)
[18:51:21 ERROR]:               net.minecraft.network.protocol.game.ServerboundInteractPacket.handle(ServerboundInteractPacket.java:67)
[18:51:21 ERROR]:               net.minecraft.network.protocol.game.ServerboundInteractPacket.handle(ServerboundInteractPacket.java:12)
[18:51:21 ERROR]:               net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:51)
[18:51:21 ERROR]:               net.minecraft.network.protocol.PlayerConnectionUtils$$Lambda$11514/0x000000080313fd60.run(Unknown Source)
[18:51:21 ERROR]:               net.minecraft.server.TickTask.run(TickTask.java:18)
[18:51:21 ERROR]:               net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153)
[18:51:21 ERROR]:               net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24)
[18:51:21 ERROR]:               net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1344)
[18:51:21 ERROR]:               net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197)
[18:51:21 ERROR]:               net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126)
[18:51:21 ERROR]:               net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1321)
[18:51:21 ERROR]:               net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1314)
[18:51:21 ERROR]:               net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136)
[18:51:21 ERROR]:               net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1292)
[18:51:21 ERROR]:               net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1180)
[18:51:21 ERROR]:               net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:322)
[18:51:21 ERROR]:               net.minecraft.server.MinecraftServer$$Lambda$4551/0x000000080198bb68.run(Unknown Source)
[18:51:21 ERROR]:               java.base@17.0.7/java.lang.Thread.run(Thread.java:833)
[18:51:21 ERROR]: ------------------------------
[18:51:21 ERROR]: --- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---
[18:51:21 ERROR]: ------------------------------
@MiniDigger
Copy link
Contributor

thats "expected", offline players might need to be looked up from mojangs auth server so you have the proper uuid, if its not cached, which is an IO call on the main thread. if your connection is slow, the auth server is slow, or you are getting rate limited by the auth server, that can stall the main thread.
paper adds a method to only get the offline player if cached, ACF could add a flag for that I guess, or you can use a string argument and use the method yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants