Status: Resolved (View Workflow)
Affects Version/s: None
Fix Version/s: None
Hey, okay this is a bigger one and took a long time to find. I am pretty sure this is a vanilla bug too (but very hard to test). I want to validate my concerns here before reporting to mojang.
- FileIOThread is the BackgroundService to save already unloaded Chunks to the specific RegionFile. This service is async
- RegionFileCache holds a bunch of cached RegionFiles for loading/unloading data
- ChunkRegionLoader uses RegionFileCache for different lookups/loading/unloading
If the maximum loaded RegionFiles in RegionFileCache is reached. A clear-method is called. This call is unsafe and will result in chunk-regenerations in this specific situation.
Change the RegionFileCache limit from 256 to 2. This should be enough to spam the console with saving-errors as the syncronization-code in RegionFileCache is faulty implemented.
Reprodution of chunk-regenerations:
Best way is to change the limit to 2 as seen above
- Create a flat world and generate enough chunks in an area
- Create a normal world
- Copy all the regionfiles from the flat world to the normal world (dont overwrite the level.dat)
- Start up the server and fly around in gamemode 3.
- The console will be full of errors. About every 1-2 minutes there will be a newly generated chunk will appear in the previously flat area.
One way to fixing this:
As the general implementation of RegionFileCache is faulty the method "c" and "d" need to be rewritten. They are the problem as they hand out *references *to region files. Instead we can change them to hand out the NBTData directly and mark them syncronized. With this setup the syncronization actually works: