Welcome, Visitor!

To access the forum content and all our services, you must register or log in to the forum. Becoming a member of the forum is completely free.

Server crashing - Out of Memory

Arktikus

New member
Joined
Jan 20, 2024
Messages
21
Hello,

My server keeps crashing after some time, because it runs out of memory.
I have 16GB available, so it meets the requirements, but seems like 16 is not enough which is insane. And most players on my server are 8…

I’m running this on a linux machine, ubuntu 22.04. The server is setup through steamcmd.

I notice, when I start the server it runs on like 2-3GB RAM, after 10-20 minutes it’s 4GB RAM. Then after 3-5 hours it crashes, because it reaches the 16GB.

Is there anything to help with that?
 
Last edited:

Arktikus

New member
Joined
Jan 20, 2024
Messages
21
My current solution I am trying:
I set up Swap Memory to 16GB, so if the server uses too much RAM it shouldn’t get killed by the OOM Killer.
Besides that I am planning to run a script that somehow restarts the server every 4-8 hours, so it starts at 2-3GB usage at the start.

EDIT:
With 16GB RAM and 16GB Swap Memory the server can run up to 12 hours very good, after that it gets laggy and crashes at some point. So this was already a great way to deal with that.
 
Last edited:

palworld

Administrator
Staff member
Joined
Jan 19, 2024
Messages
151
@Arktikus How long it takes to crash?

Memory usage increase the over time so best way to keep server at best performance is that you can restart the game server every 6 hours or 12 hours?

Just create a cronjob for restarting.

If you need help for crontab just ask 🙂
 

Arktikus

New member
Joined
Jan 20, 2024
Messages
21
It takes roughly 3-5 hours. Now with the SWAP Memory it should last much longer, but that isn’t optimal and severly decreases the performance I think.

And yes thank you for the fast answer.
Automatic restarting sounds good. If you could provide help with the cronjob that would be amazing!
 

palworld

Administrator
Staff member
Joined
Jan 19, 2024
Messages
151
Use this command to open crontab jobs:

crontab -e

Add this line:
Code:
0 */6 * * * command_to_run
command_to_run is should be your starting command. Don’t forget to add file path.
 

Arktikus

New member
Joined
Jan 20, 2024
Messages
21
Thank you for the help!
But does this also stop/close the server?
So basically this would run the start script to start the server, but how do I stop the server? Or does this happen automatically?

Currently I am using screen to “run” the server so 😃
 

palworld

Administrator
Staff member
Joined
Jan 19, 2024
Messages
151
Oops, my mistake. I can create a systemd service that stops the server if it’s running and then starts it again. It takes time probably I can do it tomorrow and paste here.
 

Arktikus

New member
Joined
Jan 20, 2024
Messages
21
That would be amazing, thank you soo much!
And no problem if it takes some time ^^
 
Last edited:

nyteknight

New member
Joined
Jan 22, 2024
Messages
3
i had created a temporarily solution-- but it doesnt address the stop/save command. Would love some help on that front ^^ .

@palworld – could you share the command to stop the server gracefully via linux? (i.e save then shutdown?)

make sure to replace the ExeStart with your start command.

To autorestart on timer:
Code:
[Unit]
Description=palworld
After=network.target

[Service]
Type=notify
User=steam
WatchdogSec=21600 # time in seconds == 6 hours
ExecStart=/home/steam/.steam/steam/steamapps/common/PalServer/PalServer.sh -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS

[Install]
WantedBy=multi-user.target
To autorestart on memory utilization
Code:
[Unit]
Description=palworld
After=network.target

[Service]
Type=simple
User=steam
Restart=on-failure
RestartSec=60s
MemoryMax=15G #optional param to restart if mem utilization surpasses this value
ExecStart=/home/steam/.steam/steam/steamapps/common/PalServer/PalServer.sh -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS

[Install]
WantedBy=multi-user.target
 

Pillgar

New member
Joined
Jan 24, 2024
Messages
3
Can I have both these running at the same time, or could you combine them together in one service?
 

crawdad59

New member
Joined
Jul 15, 2024
Messages
3

My current solution I am trying:
I set up Swap Memory to 16GB, so if the server uses too much RAM it shouldn’t get killed by the OOM Killer.
Besides that I am planning to run a script that somehow restarts the server every 4-8 hours, so it starts at 2-3GB usage at the start.

EDIT:
With 16GB RAM and 16GB Swap Memory the server can run up to 12 hours very good, after that it gets laggy and crashes at some point. So this was already a great way to deal with that.
so i have been messing with settings and i changed the default DropItemMaxNum setting to 2500 items and no invaders. i have had a stable server for over 12 hours no restarts