Log Removal warning on Folia
ewof opened this issue ยท 5 comments
[18:17:34 WARN]: [SmoothTimber] Async task for SmoothTimber v1.26.0 generated an exception
java.lang.NullPointerException: Cannot read field "captureTreeGeneration" because the return value of "net.minecraft.world.level.World.getCurrentWorldData()" is null
at net.minecraft.world.level.Level.getBlockState(Level.java:1215) ~[?:?]
at org.bukkit.craftbukkit.v1_20_R3.block.CraftBlock.getType(CraftBlock.java:238) ~[folia-1.20.4.jar:git-Folia-"25ee657"]
at net.coreprotect.CoreProtectAPI.logRemoval(CoreProtectAPI.java:330) ~[CoreProtect-22.2.jar:?]
at com.syntaxphoenix.spigot.smoothtimber.compatibility.coreprotect.CoreCompat_v1_13_x.logRemoval(CoreCompat_v1_13_x.java:19) ~[smoothtimber-legacy-1.26.0.jar:?]
at com.syntaxphoenix.spigot.smoothtimber.compatibility.coreprotect.CoreProtectGrowListener.lambda$onGrow$0(CoreProtectGrowListener.java:29) ~[smoothtimber-legacy-1.26.0.jar:?]
at com.syntaxphoenix.spigot.smoothtimber.platform.FoliaPlatform.lambda$asyncTaskLater$6(FoliaPlatform.java:82) ~[smoothtimber-legacy-1.26.0.jar:?]
at io.papermc.paper.threadedregions.scheduler.FoliaAsyncScheduler$AsyncScheduledTask.run(FoliaAsyncScheduler.java:217) ~[folia-1.20.4.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
at java.lang.Thread.run(Thread.java:1583) ~[?:?]
The issue is that SmoothTimber is passing data into an async thread that isn't safe for Folia.
I.e. the issue here is that SmoothTimber doesn't fully support Folia.
SmoothTimber is working with already read data (BlockStates) while the CoreProtectAPI does not.
In my opinion it's not our issue to call your api in a thread that is suited for your access to data in the world.
You are the one trying to access the world data in your api instead of exposing a method that allows other developers to skip this step, this is unnecessary.
We're not just supporting CoreProtect in our plugin however so far the CoreProtectAPI was the only thing that caused issues when being used on Folia. So I would say this is just bad api design meaning the one that does not fully support Folia is not SmoothTimber but CoreProtect instead as the API does not comply with folia standards.
You will see that your API is accessing the world (in the stack trace) and not SmoothTimber.
Also please note that I'm not trying to attack anyone here and I apologize if any of the above sounds rude in any way