A
Admincraftโ€ข2mo ago
Priority6

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
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
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...
Jump to solution
72 Replies
Chibi Bot Admincraft
Chibi Bot Admincraftโ€ข2mo ago
๐Ÿ“‹ Spark profile attached:
Chibi Bot Admincraft
Chibi Bot Admincraftโ€ข2mo ago
๐Ÿ“‹ Spark profile attached:
Priority6
Priority6OPโ€ข2mo ago
Using EnviroMC Prem with around 12gb of RAM (no clue why it shows 10 in the Spark profiler)
Priority6
Priority6OPโ€ข2mo ago
Here are all the mods i've added since last world. Maybe its one of these?
No description
No description
Priority6
Priority6OPโ€ข2mo ago
(also the terratonic datapack) Maybe Bluemap is also causing this, but I am unsure
Snow Kit
Snow Kitโ€ข2mo ago
can you start a spark profile with /spark profiler start --alloc
start the profiler and profile memory allocations (memory pressure) instead of CPU usage.
Priority6
Priority6OPโ€ข2mo ago
thats smart, yes i can I'll come back in about 5 mins as it gathers data
Priority6
Priority6OPโ€ข2mo ago
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
Chibi Bot Admincraft
Chibi Bot Admincraftโ€ข2mo ago
๐Ÿ“‹ Spark profile attached:
Priority6
Priority6OPโ€ข2mo ago
This is apparently it
Snow Kit
Snow Kitโ€ข2mo ago
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
Priority6
Priority6OPโ€ข2mo ago
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
Snow Kit
Snow Kitโ€ข2mo ago
you can try doing --alloc with --thread * too. Whatever is using all the memory clearly isn't on the main thread
Priority6
Priority6OPโ€ข2mo ago
Like so?
/spark profiler start --alloc --thread *
/spark profiler start --alloc --thread *
I just restarted the server so it might be another few hours before this happens again.
Tamz
Tamzโ€ข2mo ago
oh wow villagers are so laggy what modpack is this?
Priority6
Priority6OPโ€ข2mo ago
A modified version of Steampunk LPS
Tamz
Tamzโ€ข2mo ago
:ugh:
Priority6
Priority6OPโ€ข2mo ago
a uh, very modified version of it
Tamz
Tamzโ€ข2mo ago
i see it was laggy asf to start with i have a solution for you tho so dw
Tamz
Tamzโ€ข2mo ago
Modrinth
ServerCore - Minecraft Mod
A mod that aims to optimize the minecraft server.
Tamz
Tamzโ€ข2mo ago
it lets you kill villager ai (basically slowing them down and causing less lag) among other things
Priority6
Priority6OPโ€ข2mo ago
yaaaaaaaaa fair i looked it up, already in the pack
Tamz
Tamzโ€ข2mo ago
oh perfect Config it
Priority6
Priority6OPโ€ข2mo ago
unless what you're talking about is something i gotta do in the config i see lol
Tamz
Tamzโ€ข2mo ago
by default it does nothing
Priority6
Priority6OPโ€ข2mo ago
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
Priority6
Priority6OPโ€ข2mo ago
any other things i should do to these configs?
Tamz
Tamzโ€ข2mo ago
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
Priority6
Priority6OPโ€ข2mo ago
sick, thanks! now we want otherwise if this doesnt work i think i might just change the modpack lol
Priority6
Priority6OPโ€ข2mo ago
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
Priority6
Priority6OPโ€ข2mo ago
and seems better
Priority6
Priority6OPโ€ข2mo ago
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
Chibi Bot Admincraft
Chibi Bot Admincraftโ€ข2mo ago
๐Ÿ“‹ Spark profile attached:
Priority6
Priority6OPโ€ข2mo ago
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
Snow Kit
Snow Kitโ€ข2mo ago
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?
Snow Kit
Snow Kitโ€ข2mo ago
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
No description
Snow Kit
Snow Kitโ€ข2mo ago
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
Priority6
Priority6OPโ€ข2mo ago
Sounds good! I'll try that now
Priority6
Priority6OPโ€ข2mo ago
@Snow Kit my only thing to say before I try this is the very first graph I showed
No description
Priority6
Priority6OPโ€ข2mo ago
and it also has decreased down to more normal levels (around 4000) but still hasnt really increased the TPS
Snow Kit
Snow Kitโ€ข2mo ago
You mentioned the lag happened when a 3rd person logged on. Could it be something at their base?
Priority6
Priority6OPโ€ข2mo ago
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
Priority6
Priority6OPโ€ข2mo ago
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
Chibi Bot Admincraft
Chibi Bot Admincraftโ€ข2mo ago
๐Ÿ“‹ Spark profile attached:
Priority6
Priority6OPโ€ข2mo ago
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
Priority6
Priority6OPโ€ข2mo ago
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
Chibi Bot Admincraft
Chibi Bot Admincraftโ€ข2mo ago
๐Ÿ“‹ Spark profile attached:
Priority6
Priority6OPโ€ข2mo ago
Ran the profiler with this
Priority6
Priority6OPโ€ข2mo ago
No description
Priority6
Priority6OPโ€ข2mo ago
This time only one player is on right now (TPS is only getting worse now)
Snow Kit
Snow Kitโ€ข2mo ago
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 use
Priority6
Priority6OPโ€ข2mo ago
Will 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
Snow Kit
Snow Kitโ€ข2mo ago
from what I can see, each time a chunk is loaded, it scans the air quality in a chunk and never releases the memory
Priority6
Priority6OPโ€ข2mo ago
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
Snow Kit
Snow Kitโ€ข2mo ago
No description
Snow Kit
Snow Kitโ€ข2mo ago
you can press this button to open the flame graph
No description
Priority6
Priority6OPโ€ข2mo ago
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
Snow Kit
Snow Kitโ€ข2mo ago
yeah, the issue is that they store in memory what can be used to breath in a block, per block
Priority6
Priority6OPโ€ข2mo ago
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?
Snow Kit
Snow Kitโ€ข2mo ago
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
Priority6
Priority6OPโ€ข2mo ago
I see, thanks! I'm running the same spark profiler again now after my server has been reset to ensure its not some fluke
Snow Kit
Snow Kitโ€ข2mo ago
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
Priority6
Priority6OPโ€ข2mo ago
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
Snow Kit
Snow Kitโ€ข2mo ago
that's fair
Priority6
Priority6OPโ€ข2mo ago
Thanks for the help so far btw!! oh my god
Priority6
Priority6OPโ€ข2mo ago
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 ...
Priority6
Priority6OPโ€ข2mo ago
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
Priority6
Priority6โ€ข2mo ago
@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
Tamz
Tamzโ€ข2mo ago
๐Ÿ˜›
Priority6
Priority6OPโ€ข2mo ago
yall have been great, tysm <3 Im closing this issue now
Priority6
Priority6OPโ€ข2mo ago
For anyone with this issue, just make a datapack with this structure and make air_quality_sensitive.json to this
{
"replace":true,
"values": [
"minecraft:player"
]
}
{
"replace":true,
"values": [
"minecraft:player"
]
}
No description
Priority6
Priority6OPโ€ข2mo ago
(afiak this is a whitelist for all entities that breathe)

Did you find this page helpful?