CaffeineMC / sodium-fabric

A Fabric mod designed to improve frame rates and reduce micro-stutter
Other
4.61k stars 785 forks source link

Sodium causing clientside chunks leak #2586

Open frosthuuuund opened 2 weeks ago

frosthuuuund commented 2 weeks ago

Bug Description

The Sodium installed causing clientsided chunks leak either by itself or makes it much noticeable. Below i attached screenshot which illustrates the problem. image

The amount of chunks on vanilla is a bit above from the starting point, but fairly enough to not set off the alarm. image

Reproduction Steps

Install 1.21 with Fabric Mod Loader. Use jdk-21.0.3.9-hotspot as your runtime. Install Sodium 0.5.11. Launch the game and create the new world with Creative mode. Set the game rule keepInventory to true. Equip elytra and firework. Set a spawnpoint on 0 320 0. Open F3 menu and follow one axis both in positive and negative direction on Gizmo debug crosshair. Fly around 1000 blocks and kill yourself with the console command. Do the same for the all axes. Keep an eye on amount of geometry pool

Log File

https://paste.nolog.cz/?9a65e0dee4dddbf2#FdqxtsRo6zU2XyumZ9ZdM1jHRjVyBWyLbduZezS9er4x

Crash Report

https://paste.nolog.cz/?4daec5abb631e610#CbPBK2LbpBALLJ2WyPgmrXYqtFm7VHuTSM7DFgLrkPnr

jellysquid3 commented 2 weeks ago

I think this problem is related to a regression in Minecraft 1.21 itself, as the chunks don't seem to get unloaded there either. Unfortunately, it would seem Sodium exacerbates the issue, because it will only unload geometry when the chunks themselves are unloaded, and not when they fall out of the render distance.

We might need to rework things to address this.

frosthuuuund commented 2 weeks ago

Alright after the additional testing i got next information:

  1. This definitely happens on vanilla. If you teleports and kills yourself enough, you'll get OOM error, with 4GB allocated, you will run out of memory pretty fast.
  2. The dev snapshot showing fair amount of clientsided chunks, but still showing leaks in the geometry pool.
  3. This happens on 1.20.1 with Sodium 0.5.11 (Java 17) and also 1.20.4 (but Java 21, probably won't make a difference).