FamroFexl / Circumnavigate

Finite, Tiled, Seamless World Wrapping Mod for Minecraft.
https://modrinth.com/project/circumnavigate
GNU Affero General Public License v3.0
19 stars 1 forks source link

[Bug]: Worlds stuck saving #24

Open FamroFexl opened 2 weeks ago

FamroFexl commented 2 weeks ago

Describe the Bug

Worlds which are quit and saved never finish saving

Mod version(s) affected

eaa5753

Mod loader(s) used

Fabric

Minecraft version(s) used

1.21.1

Other mods used

No response

To Reproduce (If applicable)

Create a new world. Save and quite to title. Notice how the "Saving world" message stays, and never goes away, requiring the client to be force quit.

Additional Information

This appears to be an issue caused by the recent fix to #10. I would guess that these fixes are now causing the world saving process to loop over itself.

Skidamek commented 2 weeks ago

I completely haven't noticed that before huh

Anyway server gets stuck on while (this.levels.values().stream().anyMatch(serverLevelx -> serverLevelx.getChunkSource().chunkMap.hasWork())) { loop in MinecraftServer.java:622 because updatingChunkMap in ChunkMap.java is not empty

FamroFexl commented 2 weeks ago

As it turns out, world saving never did work properly in 1.21.1. For some reason, MANY bugs didn't exist in the development environment and only showed up in production, which I never thought to test. 😩 All these issues were brought to light in #26.

FamroFexl commented 2 weeks ago

Temp fixed by disabling ChunkTrackerMixin's modified getComputedLevel method while the world is saving. This is something I will deal with in the future.

FamroFexl commented 2 weeks ago

@Skidamek I know why your getComputedLevel method doesn't work properly. Your TransformerRequests.chunkCacheLevel.getTransformer() is inapplicable for your method. It only works for the checkNeighborsAfterUpdate method because it is assigned before that method is run.

Your method is called in over a dozen different places where the TransformerRequests.chunkCacheLevel has not been reassigned, leading to it being often WorldTransformer.INVALID. Your method is used by both ChunkTracker.update() and SectionTracker.update(). These update() methods have 12 usages combined in DistanceManager, TickingTracker, and PoiManager, but the closest Level to obtain the transformer from is further up in the ServerChunkCache.

FamroFexl commented 2 weeks ago

This doesn't fix the issue, but it certainly is contributing to the problems.

Skidamek commented 2 weeks ago

TransformerRequests is a foot gun let's use interface injection for more places where it's needed instead of that

FamroFexl commented 2 weeks ago

Anyways, I'm putting this issue on hold until I feel like investigating it later.