PlayPro / CoreProtect

CoreProtect is a blazing fast data logging and anti-griefing tool for Minecraft servers.
Artistic License 2.0
582 stars 259 forks source link

Log Removal warning on Folia #530

Open ewof opened 2 months ago

ewof commented 2 months ago
[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) ~[?:?]

https://github.com/SourceWriters/SmoothTimber/issues/84

Intelli commented 2 months ago

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.

Lauriichan commented 2 months ago

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.

Lauriichan commented 2 months ago

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.

Lauriichan commented 2 months ago

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

stale[bot] commented 4 days ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.