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
Admincraft Meta
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
Admincraft Meta
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
Flavour
FlavourOP2y ago
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.
QarthO
QarthO2y ago
Are you on a modded server?
Flavour
FlavourOP2y ago
Yes, running Direwolf20 19.2, I believe.
QarthO
QarthO2y ago
You won’t be able to use spigot/paper or anything if ur on a modded server
Flavour
FlavourOP2y ago
ah okay
QarthO
QarthO2y ago
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
Flavour
FlavourOP2y ago
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.
QarthO
QarthO2y ago
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
Flavour
FlavourOP2y ago
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.
QarthO
QarthO2y ago
🫡
Flavour
FlavourOP2y ago
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
QarthO
QarthO2y ago
Swap is never good for running stuff Its kind of a mediator/backup plan But significantly slower usually
Flavour
FlavourOP2y ago
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
QarthO
QarthO2y ago
Well… if u r using 4/4 of swap So looks like u need it
Flavour
FlavourOP2y ago
Server is meant to be allocated 6G also, I think the startup flags were missing on the launch that report is from.
QarthO
QarthO2y ago
Well u don’t have 6gb to give according to this report
Flavour
FlavourOP2y ago
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.
QarthO
QarthO2y ago
Yeah my guess is there’s lots of random background processes he needs to disable and remove from startup
Flavour
FlavourOP2y ago
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.
QarthO
QarthO2y ago
There should be like 14gb free (before the Minecraft server) But the computer has 0gb free (using 4/4gb of swap is bad)
Flavour
FlavourOP2y ago
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.
QarthO
QarthO2y ago
I’m on my phone, and can’t easily go thru the report
Flavour
FlavourOP2y ago
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?
Flavour
FlavourOP2y ago
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.
QarthO
QarthO2y ago
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
Flavour
FlavourOP2y ago
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
QarthO
QarthO2y ago
yeah, you can increase as needed
Flavour
FlavourOP2y ago
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?
ProGamingDk
ProGamingDk2y ago
u can pregen any dimension
QarthO
QarthO2y ago
use chunky and the vanilla world border is pretty good if u want diff shapes, can use chunky border
ProGamingDk
ProGamingDk2y ago
chunky dev build if u want speed
QarthO
QarthO2y ago
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.
1who¡ssus?
1who¡ssus?2y ago
I'm with a 40 gb world file lol And a 9 gb bluemap database

Did you find this page helpful?