Load My Chunks

Load My Chunks

9.9k Downloads

[CONFLICT] Concurrent Chunk Management Engine

Drathonix opened this issue · 3 comments

commented

Encountered originally in #3, CCME causes a conflict with the FastUtil rehash function for our chunk data manager.

// Who set us up the TNT?

Time: 2024-06-25 08:53:49
Description: Exception chunk generation/loading

java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 65
	at it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap.rehash(Long2ObjectLinkedOpenHashMap.java:1809)
	at it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap.insert(Long2ObjectLinkedOpenHashMap.java:315)
	at it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap.computeIfAbsent(Long2ObjectLinkedOpenHashMap.java:782)
	at com.vicious.loadmychunks.common.system.ChunkDataManager$LevelChunkLoaderManager.getOrCreateData(ChunkDataManager.java:217)
	at com.vicious.loadmychunks.common.system.ChunkDataManager$LevelChunkLoaderManager.getOrCreateData(ChunkDataManager.java:189)
	at com.vicious.loadmychunks.common.system.ChunkDataManager.getOrCreateChunkData(ChunkDataManager.java:132)
	at MC//net.minecraft.world.chunk.WorldChunk.handler$die000$loadmychunks$setup(WorldChunk.java:4791)
	at MC//net.minecraft.world.chunk.WorldChunk.<init>(WorldChunk.java:111)
	at MC//net.minecraft.world.ChunkSerializer.deserialize(ChunkSerializer.java:166)
	at MC//net.minecraft.server.world.ServerChunkLoadingManager.md3d23ee$c2me-threading-chunkio$lambda$c2me$loadChunk0$5$1a(ServerChunkLoadingManager.java:8944)
	at [email protected]/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
	at [email protected]/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
	at com.ishland.c2me.base.common.scheduler.WrappingTask.run(WrappingTask.java:21)
	at com.ishland.flowsched.executor.WorkerThread.pollTasks(WorkerThread.java:56)
	at com.ishland.flowsched.executor.WorkerThread.run(WorkerThread.java:27)
commented

Fixed in 1.0.5

commented

The async serialization system in C2ME expects the ChunkSerializer#deserialize and ChunkSerializer#serialize to be parallel capable. MixinWorldChunk#setup break this assumption and therefore it is crashing there since it is not parallel capable.

The easiest way to solve this is to synchronize ChunkDataManager$LevelChunkLoaderManager#data and ChunkDataManager#levelManagers.

commented

The async serialization system in C2ME expects the ChunkSerializer#deserialize and ChunkSerializer#serialize to be parallel capable. MixinWorldChunk#setup break this assumption and therefore it is crashing there since it is not parallel capable.

The easiest way to solve this is to synchronize ChunkDataManager$LevelChunkLoaderManager#data and ChunkDataManager#levelManagers.

You know whats funny, I already patched this in an alpha but I completely forgot about the "sychronized" modifier 🤦 . I'll make sure to undo my stupid and apply the smart.