Galactifun icon indicating copy to clipboard operation
Galactifun copied to clipboard

Crash upon generating chunks in earth's orbit

Open GentlemanCheesy opened this issue 2 years ago • 7 comments

Description (Required)

When a player visited earths orbit it crashed the server. Upon deleting the world and trying to regenerate it to try to solve the issue the server crashes on start up.

Steps to reproduce the Issue (Required)

Unsure but it may be an issue with generating the chunks in 1.20 Minecraft. It happened as soon as the dimension was loaded.

Expected behavior (Required)

Not crashing on startup or world generation.

Server Log / Error Report

Crash report: https://pastebin.com/H7rnJHYz Logs: https://pastebin.com/Hcv56tea

Environment (Required)

Galactifun Dev 76 Slimefun Dev Build 1092 Paper Build 101 1.20.1

GentlemanCheesy avatar Aug 04 '23 17:08 GentlemanCheesy

This is really strange... The appropriate checks are in place... Can you try doing a clean Galactifun/Slimefun install? As in redownload and replace the JARs

Seggan avatar Aug 05 '23 00:08 Seggan

Actually, it might be a parallelization issue (data race); lemme cook up a test build

Seggan avatar Aug 05 '23 00:08 Seggan

so strange... i did this change:

boolean before_err = false, after_err = false;
if (x < -7 || y < -7 || z < -7 || x > 7 || y > 7 || z > 7) {
	System.out.println("Unexcepted location! (" + x + ", " + y + ", " + z + ")");
	before_err = true;
}
if (this.currentMaterial >= 3) {
	System.out.println("Unexcepted value! " + this.currentMaterial);
	this.currentMaterial = 0;
	before_err = true;
}
if (this.currentMiddle == null) {
	System.out.println("this.currentMiddle is null");
	before_err = true;
}
if (before_err) {
	System.out.println("before: Calling with " + x + ", " + y + ", " + z + " :: " + this.currentMaterial);
	if (this.currentMiddle != null) {
		System.out.println("this.currentMiddle is " + this.currentMiddle.toString());
	}
}
int _old = this.currentMaterial;
this.currentRegion.setType(currentMiddle.clone().add(x, y, z), this.materials[this.currentMaterial++]);
if (_old != this.currentMaterial - 1) {
	System.out.println("Info Mismatch! " + _old + " & " + this.currentMaterial);
	after_err = true;
}
if (this.currentMaterial > 3) {
	System.out.println("Unexcepted value! " + this.currentMaterial);
	after_err = true;
}
if (this.currentMiddle == null) {
	System.out.println("this.currentMiddle is null");
	after_err = true;
}
if (after_err) {
	System.out.println("after: Calling with " + x + ", " + y + ", " + z);
	if (this.currentMiddle != null) {
		System.out.println("this.currentMiddle is " + this.currentMiddle.toString());
	}
}
if (this.currentMaterial == this.materials.length) {
	this.currentMaterial = 0;
}

then in the test:

[17:57:47 INFO]: [Galactifun] [STDOUT] Info Mismatch! 2 & 4
[17:57:47 INFO]: [Galactifun] [STDOUT] Unexcepted value! 4
[17:57:47 INFO]: [Galactifun] [STDOUT] after: Calling with 0, 0, 0
[17:57:47 ERROR]: [ChunkTaskScheduler] Chunk system error at chunk (99,-140), holder: NewChunkHolder{world=world_galactifun_earth_orbit, chunkX=99, chunkZ=-140, entityChunkFromDisk=false, lastChunkCompletion={chunk_class=net.minecraft.world.level.chunk.ProtoChunk,status=minecraft:carvers}, currentGenStatus=minecraft:carvers, requestedGenStatus=minecraft:initialize_light, generationTask=ChunkProgressionTask{class: io.papermc.paper.chunk.system.scheduling.ChunkUpgradeGenericStatusTask, for world: world_galactifun_earth_orbit, chunk: (99,-140), hashcode: 1603112352, priority: COMPLETING, status: minecraft:features, scheduled: true}, generationTaskStatus=minecraft:features, priority=NORMAL, priorityLocked=false, neighbourRequestedPriority=NORMAL, effective_priority=NORMAL, oldTicketLevel=34, currentTicketLevel=34, totalNeighboursUsingThisChunk=9, fullNeighbourChunksLoadedBitset=32505856, chunkStatusRaw=0, currentChunkStatus=INACCESSIBLE, pendingChunkStatus=INACCESSIBLE, is_unload_safe=ticket_level, killed=false}, exception:
java.lang.Throwable: java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3
        at io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.unrecoverableChunkSystemFailure(ChunkTaskScheduler.java:276) ~[paper-1.20.2.jar:git-Paper-318]
        at io.papermc.paper.chunk.system.scheduling.NewChunkHolder.lambda$setGenerationTask$4(NewChunkHolder.java:1700) ~[paper-1.20.2.jar:git-Paper-318]
        at io.papermc.paper.chunk.system.scheduling.ChunkProgressionTask.complete0(ChunkProgressionTask.java:95) ~[paper-1.20.2.jar:git-Paper-318]
        at io.papermc.paper.chunk.system.scheduling.ChunkProgressionTask.complete(ChunkProgressionTask.java:75) ~[paper-1.20.2.jar:git-Paper-318]
        at io.papermc.paper.chunk.system.scheduling.ChunkUpgradeGenericStatusTask.run(ChunkUpgradeGenericStatusTask.java:105) ~[paper-1.20.2.jar:git-Paper-318]
        at io.papermc.paper.chunk.system.scheduling.queue.RadiusAwarePrioritisedExecutor$Task.run(RadiusAwarePrioritisedExecutor.java:467) ~[paper-1.20.2.jar:git-Paper-318]
        at ca.spottedleaf.concurrentutil.executor.standard.PrioritisedThreadedTaskQueue$PrioritisedTask.executeInternal(PrioritisedThreadedTaskQueue.java:351) ~[paper-1.20.2.jar:git-Paper-318]
        at ca.spottedleaf.concurrentutil.executor.standard.PrioritisedThreadedTaskQueue.executeTask(PrioritisedThreadedTaskQueue.java:118) ~[paper-1.20.2.jar:git-Paper-318]
        at ca.spottedleaf.concurrentutil.executor.standard.PrioritisedThreadPool$PrioritisedThread.pollTasks(PrioritisedThreadPool.java:274) ~[paper-1.20.2.jar:git-Paper-318]
        at ca.spottedleaf.concurrentutil.executor.standard.PrioritisedQueueExecutorThread.run(PrioritisedQueueExecutorThread.java:62) ~[paper-1.20.2.jar:git-Paper-318]
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3
        at io.github.addoncommunity.galactifun.util.Sphere.gen(Sphere.java:158) ~[Galactifun-Build 24 (git 8e97c63).jar:?]
        at io.github.addoncommunity.galactifun.util.Sphere.genEdges(Sphere.java:113) ~[Galactifun-Build 24 (git 8e97c63).jar:?]
        at io.github.addoncommunity.galactifun.util.Sphere.generate(Sphere.java:59) ~[Galactifun-Build 24 (git 8e97c63).jar:?]
        at io.github.addoncommunity.galactifun.base.universe.earth.EarthOrbit$2.populate(EarthOrbit.java:91) ~[Galactifun-Build 24 (git 8e97c63).jar:?]
        at net.minecraft.world.level.chunk.ChunkGenerator.applyBiomeDecoration(ChunkGenerator.java:490) ~[paper-1.20.2.jar:git-Paper-318]
        at org.bukkit.craftbukkit.v1_20_R2.generator.CustomChunkGenerator.a(CustomChunkGenerator.java:301) ~[paper-1.20.2.jar:git-Paper-318]
        at net.minecraft.world.level.chunk.ChunkStatus.lambda$static$11(ChunkStatus.java:127) ~[paper-1.20.2.jar:git-Paper-318]
        at net.minecraft.world.level.chunk.ChunkStatus$SimpleGenerationTask.doWork(ChunkStatus.java:342) ~[?:?]
        at net.minecraft.world.level.chunk.ChunkStatus.generate(ChunkStatus.java:259) ~[paper-1.20.2.jar:git-Paper-318]
        at io.papermc.paper.chunk.system.scheduling.ChunkUpgradeGenericStatusTask.run(ChunkUpgradeGenericStatusTask.java:86) ~[paper-1.20.2.jar:git-Paper-318]
        ... 5 more
[17:57:47 INFO]: [Galactifun] [STDOUT] this.currentMiddle is Location{world=CraftWorld{name=world_galactifun_earth_orbit},x=1864.0,y=203.0,z=-2041.0,pitch=0.0,yaw=0.0}
[17:57:47 INFO]: [Galactifun] [STDOUT] Unexcepted value! 4
[17:57:47 INFO]: [Galactifun] [STDOUT] before: Calling with 6, 0, 0 :: 0
[17:57:47 INFO]: [Galactifun] [STDOUT] this.currentMiddle is Location{world=CraftWorld{name=world_galactifun_earth_orbit},x=1864.0,y=203.0,z=-2041.0,pitch=0.0,yaw=0.0}
[17:57:47 INFO]: [Galactifun] [STDOUT] Info Mismatch! 0 & 0
[17:57:47 INFO]: [Galactifun] [STDOUT] after: Calling with 1, 2, 3
[17:57:47 INFO]: [Galactifun] [STDOUT] this.currentMiddle is Location{world=CraftWorld{name=world_galactifun_earth_orbit},x=1864.0,y=183.0,z=-1576.0,pitch=0.0,yaw=0.0}
[17:57:47 INFO]: [Galactifun] [STDOUT] Info Mismatch! 0 & 2
[17:57:47 INFO]: [Galactifun] [STDOUT] this.currentMiddle is null
[17:57:47 INFO]: [Galactifun] [STDOUT] after: Calling with -1, 2, 3
[17:57:47 INFO]: [Galactifun] [STDOUT] this.currentMiddle is null
[17:57:47 INFO]: [Galactifun] [STDOUT] before: Calling with 1, -2, 3 :: 2
[17:57:47 ERROR]: [ChunkTaskScheduler] Chunk system error at chunk (116,-99), holder: NewChunkHolder{world=world_galactifun_earth_orbit, chunkX=116, chunkZ=-99, entityChunkFromDisk=false, lastChunkCompletion={chunk_class=net.minecraft.world.level.chunk.ProtoChunk,status=minecraft:carvers}, currentGenStatus=minecraft:carvers, requestedGenStatus=minecraft:initialize_light, generationTask=ChunkProgressionTask{class: io.papermc.paper.chunk.system.scheduling.ChunkUpgradeGenericStatusTask, for world: world_galactifun_earth_orbit, chunk: (116,-99), hashcode: 1530298290, priority: COMPLETING, status: minecraft:features, scheduled: true}, generationTaskStatus=minecraft:features, priority=NORMAL, priorityLocked=false, neighbourRequestedPriority=NORMAL, effective_priority=NORMAL, oldTicketLevel=34, currentTicketLevel=34, totalNeighboursUsingThisChunk=3, fullNeighbourChunksLoadedBitset=0, chunkStatusRaw=0, currentChunkStatus=INACCESSIBLE, pendingChunkStatus=INACCESSIBLE, is_unload_safe=ticket_level, killed=false}, exception:
java.lang.Throwable: java.lang.NullPointerException: Cannot invoke "org.bukkit.Location.clone()" because "this.currentMiddle" is null
        at io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.unrecoverableChunkSystemFailure(ChunkTaskScheduler.java:276) ~[paper-1.20.2.jar:git-Paper-318]
        at io.papermc.paper.chunk.system.scheduling.NewChunkHolder.lambda$setGenerationTask$4(NewChunkHolder.java:1700) ~[paper-1.20.2.jar:git-Paper-318]
        at io.papermc.paper.chunk.system.scheduling.ChunkProgressionTask.complete0(ChunkProgressionTask.java:95) ~[paper-1.20.2.jar:git-Paper-318]
        at io.papermc.paper.chunk.system.scheduling.ChunkProgressionTask.complete(ChunkProgressionTask.java:75) ~[paper-1.20.2.jar:git-Paper-318]
        at io.papermc.paper.chunk.system.scheduling.ChunkUpgradeGenericStatusTask.run(ChunkUpgradeGenericStatusTask.java:105) ~[paper-1.20.2.jar:git-Paper-318]
        at io.papermc.paper.chunk.system.scheduling.queue.RadiusAwarePrioritisedExecutor$Task.run(RadiusAwarePrioritisedExecutor.java:467) ~[paper-1.20.2.jar:git-Paper-318]
        at ca.spottedleaf.concurrentutil.executor.standard.PrioritisedThreadedTaskQueue$PrioritisedTask.executeInternal(PrioritisedThreadedTaskQueue.java:351) ~[paper-1.20.2.jar:git-Paper-318]
        at ca.spottedleaf.concurrentutil.executor.standard.PrioritisedThreadedTaskQueue.executeTask(PrioritisedThreadedTaskQueue.java:118) ~[paper-1.20.2.jar:git-Paper-318]
        at ca.spottedleaf.concurrentutil.executor.standard.PrioritisedThreadPool$PrioritisedThread.pollTasks(PrioritisedThreadPool.java:274) ~[paper-1.20.2.jar:git-Paper-318]
        at ca.spottedleaf.concurrentutil.executor.standard.PrioritisedQueueExecutorThread.run(PrioritisedQueueExecutorThread.java:62) ~[paper-1.20.2.jar:git-Paper-318]
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.Location.clone()" because "this.currentMiddle" is null
        at io.github.addoncommunity.galactifun.util.Sphere.gen(Sphere.java:158) ~[Galactifun-Build 24 (git 8e97c63).jar:?]
        at io.github.addoncommunity.galactifun.util.Sphere.genCorners(Sphere.java:127) ~[Galactifun-Build 24 (git 8e97c63).jar:?]
        at io.github.addoncommunity.galactifun.util.Sphere.generate(Sphere.java:72) ~[Galactifun-Build 24 (git 8e97c63).jar:?]
        at io.github.addoncommunity.galactifun.base.universe.earth.EarthOrbit$2.populate(EarthOrbit.java:91) ~[Galactifun-Build 24 (git 8e97c63).jar:?]
        at net.minecraft.world.level.chunk.ChunkGenerator.applyBiomeDecoration(ChunkGenerator.java:490) ~[paper-1.20.2.jar:git-Paper-318]
        at org.bukkit.craftbukkit.v1_20_R2.generator.CustomChunkGenerator.a(CustomChunkGenerator.java:301) ~[paper-1.20.2.jar:git-Paper-318]
        at net.minecraft.world.level.chunk.ChunkStatus.lambda$static$11(ChunkStatus.java:127) ~[paper-1.20.2.jar:git-Paper-318]
        at net.minecraft.world.level.chunk.ChunkStatus$SimpleGenerationTask.doWork(ChunkStatus.java:342) ~[?:?]
        at net.minecraft.world.level.chunk.ChunkStatus.generate(ChunkStatus.java:259) ~[paper-1.20.2.jar:git-Paper-318]
        at io.papermc.paper.chunk.system.scheduling.ChunkUpgradeGenericStatusTask.run(ChunkUpgradeGenericStatusTask.java:86) ~[paper-1.20.2.jar:git-Paper-318]
        ... 5 more

how?

vochant avatar Aug 20 '24 10:08 vochant

It might be Async chunkGen after 1.20 I tested chunk generation thread and it is not primary thread In Sphere.class You should replace these temporary location field with parameters in methods and make gen operation Atomic

m1919810 avatar Jan 26 '25 13:01 m1919810