WearBlackAllDay / DimensionalThreading

An attempt to optimize the fabric server, by assigning each dimension their own thread.
MIT License
255 stars 22 forks source link

Crash after enabling gamerule #67

Closed skerit closed 2 years ago

skerit commented 2 years ago

I got this crash in 1.19 immediately after enabling the gamerule: This happened after starting the server with DimensionalThreading disabled, and enabling it manually after it has started.

[23:14:50] [Server thread/INFO]: [Skerit: Gamerule dimthread_active is now set to: true]
[23:14:50] [Server thread/ERROR]: Encountered an unexpected exception
net.minecraft.class_148: Exception ticking world
    at wearblackallday.dimthread.util.CrashInfo.crash(CrashInfo.java:12) ~[DimThread-1.2.7.jar:?]
    at net.minecraft.server.MinecraftServer.handler$zmc000$tickWorlds(MinecraftServer.java:5820) ~[server-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:864) ~[server-intermediary.jar:?]
    at net.minecraft.class_3176.method_3813(class_3176.java:289) ~[server-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:819) ~[server-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.handler$zfe000$modifiedRunLoop(MinecraftServer.java:4380) ~[server-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:644) ~[server-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:258) ~[server-intermediary.jar:?]
    at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.class_2791.method_8320(net.minecraft.class_2338)" because "net.minecraft.class_1948.cachedChunk" is null
    at net.minecraft.class_1948.redirect$bnp000$fastBlockStateLookup$1(class_1948.java:1694) ~[server-intermediary.jar:?]
    at net.minecraft.class_1948.method_38091(class_1948.java:397) ~[server-intermediary.jar:?]
    at net.minecraft.class_1948.method_29950(class_1948.java:389) ~[server-intermediary.jar:?]
    at net.minecraft.class_1948.method_8664(class_1948.java:380) ~[server-intermediary.jar:?]
    at net.minecraft.class_1948.method_24930(class_1948.java:265) ~[server-intermediary.jar:?]
    at net.minecraft.class_1948.method_8663(class_1948.java:212) ~[server-intermediary.jar:?]
    at net.minecraft.class_1948.redirect$zia000$spawnMultipleTimes(class_1948.java:1334) ~[server-intermediary.jar:?]
    at net.minecraft.class_1948.method_27821(class_1948.java:200) ~[server-intermediary.jar:?]
    at net.minecraft.class_3215.method_14161(class_3215.java:376) ~[server-intermediary.jar:?]
    at net.minecraft.class_3215.method_12127(class_3215.java:323) ~[server-intermediary.jar:?]
    at net.minecraft.class_3218.method_18765(class_3218.java:318) ~[server-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.md7daec5$lambda$tickWorlds$0$3(MinecraftServer.java:5810) ~[server-intermediary.jar:?]
    at wearblackallday.dimthread.DimThread.swapThreadsAndRun(DimThread.java:34) ~[DimThread-1.2.7.jar:?]
    at net.minecraft.server.MinecraftServer.md7daec5$lambda$tickWorlds$1$2(MinecraftServer.java:5808) ~[server-intermediary.jar:?]
    at wearblackallday.util.ThreadPool.lambda$execute$1(ThreadPool.java:49) ~[com_github_wearblackallday_javau-bd58640372-35ccf0e183c6d6cd.jar:?]
    at wearblackallday.util.ThreadPool.lambda$execute$0(ThreadPool.java:43) ~[com_github_wearblackallday_javau-bd58640372-35ccf0e183c6d6cd.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
    ... 1 more
skerit commented 2 years ago

I believe this might be a compatibility issue with ServerCore. It's caching some values that will get changed by different threads at the same time. Shouldn't be too hard to fix over there.

skerit commented 2 years ago

Issue has been fixed in ServerCore, been using both for a few days now without problems.