Self Hosted server running out of memory and crashing
Hello, I'm here on behalf of a friend (he's asleep atm) who is hosting a server for our small group (like 2-4 max).
Spark log: https://spark.lucko.me/uwL7gPZmt6
I have a crash log as well, I assume it is safe to post in terms of PII? Don't want to post something that would negatively impact him :D
Unfortunately there were no actual crashes during the log as I was unable to capture the log link since the server wasn't responding to my open command during a later crash.
Essentially the issue is that, over time, the performance of the server degrades and memory usage climbs, eventually resulting in at least one OOM crash I've seen.
Typically when this happens the server doesn't actually terminate properly, so the restart script he has doesn't fire (any advice on a better way to handle automated onlining after crash would be appreciated).
I'm going to make a couple of assumptions, please correct me if I'm wrong on anything. I assume removing the ability for the server to access swap memory would be beneficial (it's on an HDD temporarily).
I also assume nothing specific in-world is causing significant problems. We were having some TPS issues earlier and I narrowed that down to Villager AI (their pathfinding/brain were going ham during bell gathering).
I resolved that by throwing them all into Ars Nouveau jars.
I am aware we are running a very bare server (no Spigot/Paper/etc, and we did not pregen chunks (can this be done on an established world safely? Would it help?)
Anyway, I'm mainly looking for information regarding automating a failsafe restart of the server on crash/oom, and any flags or general server config stuff that might help.
I appreciate any and all advice though. I will caveat that I have almost no experience with Linux and my friend is very new to it, and still learning. Same goes for MC Server stuff.
TIA o/
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
36 Replies
Spark Profile Analysis
❌ Processing Error
The bot cannot process this Spark profile. It appears that the platform is not supported for analysis. Platform: Forge
Requested by flavour.#0
Thanks for asking your question!
Make sure to provide as much helpful information as possible such as logs/what you tried and what your exact issue is
Make sure to mark solved when issue is solved!!!
/close
!close
!solved
!answered
Requested by flavour.#0
I will add that we're definitely open to using spigot/paper/whatever (I'm not sure how they work, I haven't looked into it). There's no specific reason we aren't, simply wasn't something we were aware of initially. So if that's something that can/should be pursued (without loss of data at least), that's fine.
Are you on a modded server?
Yes, running Direwolf20 19.2, I believe.
You won’t be able to use spigot/paper or anything if ur on a modded server
ah okay
are you hosting the computer on the same device ur playing Minecraft?
Well ur friend
Cause put simply, the computer is running out of memory
No, his server machine is separate, though it is running I believe a Plex server as well. That's only serving one connection at most at a time though, and rarely. The issues persist even when nothing else is being done on the server.
Yeah, well I see the Minecraft server is allocated 4gb of ram, yet the computer is using 14 of 15gb then 4 of 4gb swap
So there’s other stuff on the computer using memory
And when u hit the cap, the server will crash
the plex media server even if no one’s connecting might use memory while idling
so trying to limit all other processes on the device would be a start
Then from there u can increase the ram on the Minecraft server only as needed
I only really noticed the memory issues tonight so haven't had much time to investigate memory allocation (it was super late for him). Will definitely check that out after work tomorrow.
🫡
On the topic of swap though, I'm assuming that's just generally still a bad idea to use on an HDD.
My wisdom on that is pretty outdated lol
Swap is never good for running stuff
Its kind of a mediator/backup plan
But significantly slower usually
Yeah I figured as much, I mentioned it earlier so will probably disable it since the drive in the machine is kinda' ass even for an HDD
Well… if u r using 4/4 of swap
So looks like u need it
Server is meant to be allocated 6G also, I think the startup flags were missing on the launch that report is from.
Well u don’t have 6gb to give according to this report
I'm assuming there's some other reason for it to be running out of memory, a single small plex server shouldn't be consuming so much memory.
But I'll get him to look into ram usage tomorrow.
Yeah my guess is there’s lots of random background processes he needs to disable and remove from startup
I ran much the same as he is on that machine on a very old laptop (the plex server and software) and it was fine with like 4gb of ram total so will need to diagnose that first I guess.
There should be like 14gb free (before the Minecraft server)
But the computer has 0gb free (using 4/4gb of swap is bad)
Are there any glaring issues with in-world stuff in that spark log? I trimmed a bunch of the more time consuming stuff for TPS, dunno if I missed something.
I’m on my phone, and can’t easily go thru the report
No worries
I don't think there are many issues there if any, TPS seems relatively stable until it starts to fail.
I suppose the last thing is automating restarts, both generally on a schedule and in case of failure, is there a decent resource I can look into for doing that?
Yeah there’s plenty
https://discord.com/channels/348681414260293634/1125440121353818183/1125441815571607642
Check this message
Perfect, thanks :)
Just a small update on this, apparently there were multiple java instances running concurrently, including two (besides the server) taking over 4G each.
yup, that'll do it
you can probably safely bump ur server up a couple of gbs from 4, but keep in mind, the less memory u use is actually better performing. only use wht u need
my current theory would be that because we had the max-tick-time at -1 (we were having freezes that were around 90s but did resolve), that it wasn't correctly terminating the instance on a crash
The server was actually supposed to be running 4-6GB range
Something got changed accidentally at some point lol
It's a fairly decently sized pack so we'll likely go with 6GB ceiling
yeah, you can increase as needed
also a different question I had, chunk pregen isn't something that's viable on an established world right?
Ah okay, might look into doing that then and setting a border at the furthest point we've been, which isn't far. Would that have any potential issues with other dimensions though?
u can pregen any dimension
use chunky
and the vanilla world border is pretty good
if u want diff shapes, can use chunky border
chunky dev build if u want speed
yup, and while its doing pregen, it will lag ur server
generally the best thing to do is, setup the pregen, come back the next day and ur good to go for the rest of ur servers life
keep in mind, pregening will generate chunks and make the world file big.
I'm with a 40 gb world file lol
And a 9 gb bluemap database