SparklyPower/SparklyPaper

Cannot read world asynchronously

Closed this issue · 5 comments

Error Log: https://mclo.gs/yNWb9Eu

I noticed this has been an issue even with FAWE (Fast Async World Edit)
Any idea how to fix this or if this a bug, will you consider fixing this?

Hi, can you test this out with mythicmobs? This works fine with paper but stops working with sparkly

That check exists because Folia also has the same check, and because SparklyPaper's parallel world ticking is somewhat based on Folia (all the thread checks were copied from Folia to avoid any corruption issues related to concurrent access) that's why the check is there. MythicMobs is accessing the world in an async thread (see CraftAsyncTask in the stacktrace).

If you really want to try it out to see if something will explode, you can add -Dsparklypaper.disableHardThrow=true to your JVM startup flags to disable all thread checks. The exception will still be logged to the console, but it won't be actually thrown. However keep in mind that this CAN cause corruption depending on what the plugin is doing, but in my experience disabling hard throws only cause the server to crash anyway due to something causing a lock up.

However, by looking at the code, I can see that the code should not explode when accessing that in an async task (Paper's chunk system can handle chunk loads in a async task) but I need to research it further (probably the checks are there because Folia requires it due to it changing Paper's chunk manager and stuff).

After looking at Folia's source code, it seems that it uses the same chunk system as the one present in Paper 1.21.1. I'm still not sure about why Paper doesn't block async world access/edit, because as far as I know you shouldn't do it.

Getting this error, is it the same issue?

[11:51:26 INFO]: DaddyRobLIVE issued server command: //set 0 [11:51:26 ERROR]: [ca.spottedleaf.moonrise.common.util.TickThread] Thread AsyncNotifyKeyedQueue - 9 failed main thread check: Cannot read world asynchronously @ world bayanihancity blockPos: BlockPos{x=-343, y=65, z=-339} - Is tick thread? false; Is server level tick thread? false; Is iterating over levels? true; Are we going to hard throw? true java.lang.Throwable: null at ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(TickThread.java:33) ~[sparklypaper-1.21.1.jar:1.21.1-DEV-0635028] at org.bukkit.craftbukkit.block.CraftBlock.getNMS(CraftBlock.java:80) ~[sparklypaper-1.21.1.jar:1.21.1-DEV-0635028] at org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(CraftBlockStates.java:247) ~[sparklypaper-1.21.1.jar:1.21.1-DEV-0635028] at org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(CraftBlockStates.java:239) ~[sparklypaper-1.21.1.jar:1.21.1-DEV-0635028] at org.bukkit.craftbukkit.block.CraftBlock.getState(CraftBlock.java:350) ~[sparklypaper-1.21.1.jar:1.21.1-DEV-0635028] at CoreProtect-22.4.jar/net.coreprotect.worldedit.WorldEditLogger.postProcess(WorldEditLogger.java:150) ~[CoreProtect-22.4.jar:?] at CoreProtect-22.4.jar/net.coreprotect.worldedit.CoreProtectLogger.processPatternToBlocks(CoreProtectLogger.java:111) ~[CoreProtect-22.4.jar:?] at CoreProtect-22.4.jar/net.coreprotect.worldedit.CoreProtectLogger.setBlocks(CoreProtectLogger.java:96) ~[CoreProtect-22.4.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extent.AbstractDelegateExtent.setBlocks(AbstractDelegateExtent.java:266) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extent.AbstractDelegateExtent.setBlocks(AbstractDelegateExtent.java:266) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extent.AbstractDelegateExtent.setBlocks(AbstractDelegateExtent.java:266) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extent.AbstractDelegateExtent.setBlocks(AbstractDelegateExtent.java:266) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.fastasyncworldedit.core.extent.PassthroughExtent.setBlocks(PassthroughExtent.java:163) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.EditSession.setBlocks(EditSession.java:1136) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.command.RegionCommands.set(RegionCommands.java:120) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.command.RegionCommandsRegistration.cmd$_set(RegionCommandsRegistration.java:607) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/org.enginehub.piston.CommandManager.execute(CommandManager.java:157) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extension.platform.PlatformCommandManager.lambda$handleCommandOnCurrentThread$16(PlatformCommandManager.java:727) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extension.platform.PlatformCommandManager.handleCommandTask(PlatformCommandManager.java:748) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extension.platform.PlatformCommandManager.handleCommandOnCurrentThread(PlatformCommandManager.java:729) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extension.platform.PlatformCommandManager.lambda$handleCommand$14(PlatformCommandManager.java:700) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extension.platform.AbstractPlayerActor.lambda$runAction$1(AbstractPlayerActor.java:672) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.fastasyncworldedit.core.util.task.AsyncNotifyKeyedQueue.lambda$run$0(AsyncNotifyKeyedQueue.java:48) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.fastasyncworldedit.core.util.task.AsyncNotifyKeyedQueue.lambda$call$1(AsyncNotifyKeyedQueue.java:58) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[?:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.fastasyncworldedit.core.util.task.KeyQueuedExecutorService$KeyRunner.lambda$run$0(KeyQueuedExecutorService.java:150) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423) ~[?:?] at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387) ~[?:?] at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312) ~[?:?] at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843) ~[?:?] at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808) ~[?:?] at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188) ~[?:?] [11:51:26 ERROR]: An unexpected error while handling a FastAsyncWorldEdit command java.lang.IllegalStateException: Cannot read world asynchronously at ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(TickThread.java:35) ~[sparklypaper-1.21.1.jar:1.21.1-DEV-0635028] at org.bukkit.craftbukkit.block.CraftBlock.getNMS(CraftBlock.java:80) ~[sparklypaper-1.21.1.jar:1.21.1-DEV-0635028] at org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(CraftBlockStates.java:247) ~[sparklypaper-1.21.1.jar:1.21.1-DEV-0635028] at org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(CraftBlockStates.java:239) ~[sparklypaper-1.21.1.jar:1.21.1-DEV-0635028] at org.bukkit.craftbukkit.block.CraftBlock.getState(CraftBlock.java:350) ~[sparklypaper-1.21.1.jar:1.21.1-DEV-0635028] at CoreProtect-22.4.jar/net.coreprotect.worldedit.WorldEditLogger.postProcess(WorldEditLogger.java:150) ~[CoreProtect-22.4.jar:?] at CoreProtect-22.4.jar/net.coreprotect.worldedit.CoreProtectLogger.processPatternToBlocks(CoreProtectLogger.java:111) ~[CoreProtect-22.4.jar:?] at CoreProtect-22.4.jar/net.coreprotect.worldedit.CoreProtectLogger.setBlocks(CoreProtectLogger.java:96) ~[CoreProtect-22.4.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extent.AbstractDelegateExtent.setBlocks(AbstractDelegateExtent.java:266) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extent.AbstractDelegateExtent.setBlocks(AbstractDelegateExtent.java:266) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extent.AbstractDelegateExtent.setBlocks(AbstractDelegateExtent.java:266) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extent.AbstractDelegateExtent.setBlocks(AbstractDelegateExtent.java:266) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.fastasyncworldedit.core.extent.PassthroughExtent.setBlocks(PassthroughExtent.java:163) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.EditSession.setBlocks(EditSession.java:1136) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.command.RegionCommands.set(RegionCommands.java:120) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.command.RegionCommandsRegistration.cmd$_set(RegionCommandsRegistration.java:607) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/org.enginehub.piston.CommandManager.execute(CommandManager.java:157) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extension.platform.PlatformCommandManager.lambda$handleCommandOnCurrentThread$16(PlatformCommandManager.java:727) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extension.platform.PlatformCommandManager.handleCommandTask(PlatformCommandManager.java:748) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extension.platform.PlatformCommandManager.handleCommandOnCurrentThread(PlatformCommandManager.java:729) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extension.platform.PlatformCommandManager.lambda$handleCommand$14(PlatformCommandManager.java:700) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.sk89q.worldedit.extension.platform.AbstractPlayerActor.lambda$runAction$1(AbstractPlayerActor.java:672) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.fastasyncworldedit.core.util.task.AsyncNotifyKeyedQueue.lambda$run$0(AsyncNotifyKeyedQueue.java:48) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.fastasyncworldedit.core.util.task.AsyncNotifyKeyedQueue.lambda$call$1(AsyncNotifyKeyedQueue.java:58) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[?:?] at FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar/com.fastasyncworldedit.core.util.task.KeyQueuedExecutorService$KeyRunner.lambda$run$0(KeyQueuedExecutorService.java:150) ~[FastAsyncWorldEdit-Bukkit-2.11.2-SNAPSHOT-883.jar:?] at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423) ~[?:?] at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387) ~[?:?] at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312) ~[?:?] at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843) ~[?:?] at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808) ~[?:?] at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188) ~[?:?]