Bug Closed · Resolved

Asynchronous entity add

#1419 opened by Unknown 5 years ago

Unknownreported this bug

Using latest dev build on 1.16.4

[14:52:54 FATAL]: Thread Craft Scheduler Thread - 54 - MythicMobs failed thread check for reason: Asynchronous entity add
java.lang.Throwable: null
        at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:15) ~[patched_1.16.4.jar:git-Yatopia-"87c3b4e"]
        at net.minecraft.server.v1_16_R3.WorldServer.addEntity0(WorldServer.java:1735) ~[patched_1.16.4.jar:git-Yatopia-"87c3b4e"]
        at net.minecraft.server.v1_16_R3.WorldServer.addEntity(WorldServer.java:1672) ~[patched_1.16.4.jar:git-Yatopia-"87c3b4e"]
        at org.bukkit.craftbukkit.v1_16_R3.CraftWorld.addEntity(CraftWorld.java:1997) ~[patched_1.16.4.jar:git-Yatopia-"87c3b4e"]
        at org.bukkit.craftbukkit.v1_16_R3.CraftWorld.spawn(CraftWorld.java:2004) ~[patched_1.16.4.jar:git-Yatopia-"87c3b4e"]
        at org.bukkit.World.spawn(World.java:2248) ~[patched_1.16.4.jar:git-Yatopia-"87c3b4e"]
        at org.bukkit.World.spawnEntity(World.java:2253) ~[patched_1.16.4.jar:git-Yatopia-"87c3b4e"]
        at io.lumine.xikage.mythicmobs.adapters.bukkit.BukkitEntityType.spawnEntity(BukkitEntityType.java:51) ~[?:?]
        at io.lumine.xikage.mythicmobs.adapters.bukkit.entities.BukkitBabyHusk.spawn(BukkitBabyHusk.java:26) ~[?:?]
        at io.lumine.xikage.mythicmobs.adapters.bukkit.BukkitEntityType.spawn(BukkitEntityType.java:30) ~[?:?]
        at io.lumine.xikage.mythicmobs.mobs.MythicMob.spawn(MythicMob.java:715) ~[?:?]
        at io.lumine.xikage.mythicmobs.skills.mechanics.SummonMechanic.castAtLocation(SummonMechanic.java:79) ~[?:?]
        at io.lumine.xikage.mythicmobs.skills.SkillMechanic.lambda$executeTargetedLocationSkill$6(SkillMechanic.java:459) ~[?:?]
        at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
        at io.lumine.xikage.mythicmobs.skills.SkillMechanic.executeTargetedLocationSkill(SkillMechanic.java:455) ~[?:?]
        at io.lumine.xikage.mythicmobs.skills.SkillMechanic.executeSkills(SkillMechanic.java:411) ~[?:?]
        at io.lumine.xikage.mythicmobs.skills.SkillMechanic.execute(SkillMechanic.java:325) ~[?:?]
        at io.lumine.xikage.mythicmobs.skills.Skill.execute(Skill.java:270) ~[?:?]
        at io.lumine.xikage.mythicmobs.skills.Skill.execute(Skill.java:245) ~[?:?]
        at io.lumine.xikage.mythicmobs.skills.mechanics.ShootMechanic$ProjectileTracker.doEndSkill(ShootMechanic.java:401) ~[?:?]
        at io.lumine.xikage.mythicmobs.skills.mechanics.ShootMechanic$ProjectileTracker.run(ShootMechanic.java:371) ~[?:?]
        at io.lumine.xikage.mythicmobs.utils.Delegates$RunnableToConsumer.accept(Delegates.java:93) ~[?:?]
        at io.lumine.xikage.mythicmobs.utils.Schedulers$LumineTask.run(Schedulers.java:162) ~[?:?]
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:99) ~[patched_1.16.4.jar:git-Yatopia-"87c3b4e"]
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:58) ~[patched_1.16.4.jar:git-Yatopia-"87c3b4e"]
        at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[patched_1.16.4.jar:git-Yatopia-"87c3b4e"]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) [?:?]
        at java.lang.Thread.run(Thread.java:832) [?:?]
Unknowncommented

I think i found the source of the issue:

  1. ShootMechanic.data has "async" set to false, as the skill is marked as ASYNC_SAFE = false
  2. ShootMechanic has an async task handling the ticking of the "tick" and "end" skills
  3. When such skils are invoked they are given a deep copy of the shoot skill's "data" object
  4. That data object still has async set to false!
  5. When the "tick" and "end" skills are executed, they think they are executed on the server thread, but in reality they are running inside an async task!
Unknowncommented

Happening to me too :/

Sign in to join the discussion.