TPS Issues, yayyyy [SOLVED: Caused by Thin Air not clearing memory for villager air quality checks]
I'm managing a server with quiet a lot of mods, and recently I updated the pack and started a new world. But for whatever reason after a few hours of play, the server will just take a nose dive in TPS.
I'm thinking it might be a memory leak, but I am unsure from what mod. Spark is not being super clear on it. My only guess is Ice & Fire since it seems like people had issues with it in the past but most posts about that issue are from 3-7 years ago lol
https://spark.lucko.me/HeMRbbMUgm
https://spark.lucko.me/mv92zrtVE3
Solution:Jump to solution
@Clyde so you were right with villagers lmao
in the datapack, it specifically still allows for villagers to "breathe" using thin air
and with terralith and since a lot of villages are at higher y-levels (and also i think just in general more y-levels), the thin-air calculations has way more villagers entities to adjust for...
72 Replies
๐ Spark profile attached:
๐ Spark profile attached:
Using EnviroMC Prem with around 12gb of RAM (no clue why it shows 10 in the Spark profiler)
Here are all the mods i've added since last world. Maybe its one of these?


(also the terratonic datapack)
Maybe Bluemap is also causing this, but I am unsure
can you start a spark profile with
/spark profiler start --alloc
start the profiler and profile memory allocations (memory pressure) instead of CPU usage.
thats smart, yes i can
I'll come back in about 5 mins as it gathers data
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
๐ Spark profile attached:
This is apparently it
you said you're running bluemap right now, right?
if you stop it for a bit, do the issues resolve?
think it might be like /bluemap freeze or something
ya, i've stopped it for 5-10 minutes. It doesnt really seem to help
It went 7 TPS to 15/16TPS when i did that command, but that seemed more like a standard fluxuation
cause now with bluemap running its running at 15/16TPS anyway
i have it set so bluemap updates every 24hrs (defaults), i dont think its that cause i feel like it would say something in the console
you can try doing
--alloc
with --thread *
too. Whatever is using all the memory clearly isn't on the main threadLike so?
I just restarted the server so it might be another few hours before this happens again.
oh wow villagers are so laggy
what modpack is this?
A modified version of Steampunk LPS
:ugh:
a uh, very modified version of it
i see
it was laggy asf to start with
i have a solution for you tho so dw
https://modrinth.com/mod/servercore/versions
Tride and true
it lets you kill villager ai (basically slowing them down and causing less lag)
among other things
yaaaaaaaaa fair
i looked it up, already in the pack
oh perfect
Config it
unless what you're talking about is something i gotta do in the config
i see lol
by default it does nothing
OH
lmao
Ill run it with the changed configs and come back to yall in a few hours or a day to see if it worked
any other things i should do to these configs?
just those
set the villager tick to 200 vs 40
200 is just slow enough that they arent Dead
but slow enough it wont lag the server
sick, thanks! now we want
otherwise if this doesnt work i think i might just change the modpack lol
This would only require me adding a few more detail mods
https://www.curseforge.com/minecraft/modpacks/create-chronicles-bosses-and-beyond
CurseForge
Create Chronicles: Bosses and Beyond
Adventure & Automation Modpack blending Create with Exploration, Magic, and Epic Bosses. 800+ Quests | Progression | Custom Recipes
160.3K Downloads | Modpacks
and seems better
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
๐ Spark profile attached:
It happened again, but more specifially cause a third player joined. Which is weird since last time my server was able to handle about 4-5 people before TPS started to slowly decrease
looks like its bluemap?
but when i disable it (Using commands) it doesnt help
So if you want to perform a small experiment, does setting the view distance in the server.properties file to 6 or 8 help the problem, or is it mostly unchanged?
the white line is the amount of chunks loaded and it's completely in line with the TPS dip, so I wonder if you're somehow just running out of memory because too many chunks are loaded

the bytes per second allocated after the additional chunks are loaded isn't increasing, so the increased GC usage is likely from memory that can't be freed and is actually leaked (or related to loaded chunks that can't be freed)
you can try starting spark with
--alloc --alloc-live-only
(--threads
shouldn't be needed anymore, as I've confirmed that nothing appears to be using memory on other threads)
start the memory allocation profiler, only retaining stats for objects that haven't been garbage collected by the end of the profile
Sounds good! I'll try that now
@Snow Kit my only thing to say before I try this is the very first graph I showed

and it also has decreased down to more normal levels (around 4000) but still hasnt really increased the TPS
You mentioned the lag happened when a 3rd person logged on. Could it be something at their base?
I doubt it, cause it only happens over time. So me and this particular person in this case have played for a couple hours together and it would be fine
then suddently it would just drop
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
๐ Spark profile attached:
here is the most recent one
so far no big lag spikes
so maybe it is chunk stuff, but that would be interesting cause i never had issues with it before?
at least, not since i upgraded my server from Oracle to EnviroMc lol
It happened again!
https://spark.lucko.me/chPaDzfWuK
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
๐ Spark profile attached:
Ran the profiler with this

This time only one player is on right now
(TPS is only getting worse now)
Apparently ~3GB of it is coming from Thin Air. It also appears that memory is being leaked when the world is saved?
I can't tell if that's leaked or the profile happened to end while the world was being saved
you can try to spam
/save-all
and see if that causes spark to report 9GB of memory in useWill do! But that's a thing for later since I'm in bed rn ๐ญ๐ญ
Thin air has never caused issues before so no idea why it would be now. Tho it's possible
from what I can see, each time a chunk is loaded, it scans the air quality in a chunk and never releases the memory
Damn, I see. I do like that mod but if it has to be axed it has to be axed
Also where are you seeing this? I see thin air is only using 172kb
Want to make sure we are on the same page

you can press this button to open the flame graph

Ooh shit
I didn't even know I could do that lol
Thanks!
This is wild. Thinair shouldn't be doing this, especially as air quality is only a function of y level and proximity to sources like lava or fire.
I'll do some more testing
yeah, the issue is that they store in memory what can be used to breath in a block, per block
Bruh, I see now
I wonder tho if some other mod causes this thin air to act like this (like pollution of the realms which I recently added). Cause again, last major world I had thin air didn't cause this. Or at least not that I'm aware of
Tho at the same time I am using terralith + tectonic, meaning the average world height is a lot higher, so maybe that's it?
well, you're only able to see it because that's memory that thin air is using. Other profilers wouldn't show it because that function is only called the tick after a chunk is loaded
so it barely uses any CPU, but the memory never gets released (as far as I'm aware), which causes issues
I see, thanks!
I'm running the same spark profiler again now after my server has been reset to ensure its not some fluke
probably don't even need to wait, you should immediately see the memory usage from thin air when chunks get loaded
spark should be able to show it before it starts lagging the server
Sick. Unfortunately I am in bed and I don't want to get out of bed to test this rn but I will definitely run it whenever I do get out
that's fair
Thanks for the help so far btw!!
oh my god
GitHub
[Bug]: air quality checks for all mobs destroy TPS ยท Issue #47 ยท Fu...
Mod Loader (Required) Forge Minecraft Version(s) (Required) 1.20.1 Mod Version(s) (Required) 88.1.5 Minimal Setup (Required) No Notes (Required) we have ~20 villagers on my server. together, these ...
but i do have a datapack which should fix it
i think in particular ice and fire does this cause a lot of the dragons of course, are very high in the air or deep underground
Solution
@Clyde so you were right with villagers lmao
in the datapack, it specifically still allows for villagers to "breathe" using thin air
and with terralith and since a lot of villages are at higher y-levels (and also i think just in general more y-levels), the thin-air calculations has way more villagers entities to adjust for
๐
yall have been great, tysm <3
Im closing this issue now
For anyone with this issue, just make a datapack with this structure and make
air_quality_sensitive.json
to this

(afiak this is a whitelist for all entities that breathe)