Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[v7.2.0] Out of Memory errors

Featured Replies

If anyone has experience with out of memory errors, I'd appreciate any time you have to spare, I'm in the middle of my work week, so I do not myself. Since upgrading to 7.2.0, I've gotten two or three of these errors now. I've got diagnostics like the fix common problems topic recommended.

aperture-diagnostics-20251103-0621.zip

Solved by Michael_P

  • Community Expert
3 hours ago, Mesmerus said:

If anyone has experience with out of memory errors, I'd appreciate any time you have to spare, I'm in the middle of my work week, so I do not myself. Since upgrading to 7.2.0, I've gotten two or three of these errors now. I've got diagnostics like the fix common problems topic recommended.

aperture-diagnostics-20251103-0621.zip

Looks like whatever 'TowerServer-Lin' is has run the host OOM twice in your logs, once on the 26th and again yesterday - if it keeps happening you can limit the memory allowed to the container or change its config so that it's not storing data in RAM

  • Author
18 hours ago, Michael_P said:

Looks like whatever 'TowerServer-Lin' is has run the host OOM twice in your logs, once on the 26th and again yesterday - if it keeps happening you can limit the memory allowed to the container or change its config so that it's not storing data in RAM

I have to facepalm and let out a little "fuck me" on that, that's a game server I've set up for Tower Unite (on Steam). Its something I've set up custom, using ich777/debian-baseimage:bullseye_amd64 as a base, but beyond that I cobbled together what I needed to set the game server up. So on the plus side, I guess that means I have complete control, but on the downside, I have no idea what kind of environment variable would be able to limit the memory allowed, and while I can likely google-fu that (eventually), I didn't even know I could set up a config so it isn't storing data in RAM, and that's honestly the path I'd rather take, because I'd say that sounds infinitely smarter, given its a game server. Soooo any tips on how I might go about changing the config so data isn't stored in RAM? XD

If it helps, these are my... compose files? Not sure if that's exactly right as a term, but figured I'd offer them instead of having to be asked for, since I'm asking for help in the first place.

root@Aperture:/mnt/user/Files/towerunite-destinyisland# ls -R
.:
Dockerfile  compose.yaml  scripts/

./scripts:
start-server.sh  start.sh

Dockerfile:

FROM ich777/debian-baseimage:bullseye_amd64

#LABEL org.opencontainers.image.authors="[email protected]"
#LABEL org.opencontainers.image.source="https://cdn.fastly.steamstatic.com/steamcommunity/public/images/items/394690/a0f0c8919e94e3dd49c3cd4515155d367f25d32c.png"

RUN apt-get update && \
        apt-get -y install --no-install-recommends lib32gcc-s1 lib32stdc++6 lib32z1 && \
        rm -rf /var/lib/apt/lists/*

VOLUME serverdata
ENV DATA_DIR="/serverdata"
ENV STEAMCMD_DIR="${DATA_DIR}/steamcmd"
ENV SERVER_DIR="${DATA_DIR}/serverfiles"
ENV GAME_ID="439660"
ENV GAME_MAP="/Game/Maps/C_Lobby1"
ENV GAME_PARAMS=""
ENV GAME_PORT=7777
ENV QUERY_PORT=27015
#ENV GAME_INI="TowerServer.ini" # commented out because when provided it will only look relative to the executable
ENV VALIDATE="false"
ENV UMASK=000
ENV UID=1000
ENV GID=1000
ENV USERNAME=""
ENV PASSWRD=#obfusicated because duh
ENV USER="destinyisland"
ENV DATA_PERM=770

RUN mkdir -p $DATA_DIR && \
        mkdir -p $STEAMCMD_DIR && \
        mkdir -p $SERVER_DIR && \
        useradd -d $DATA_DIR -s /bin/bash $USER && \
        chown -R $USER $DATA_DIR && \
        ulimit -n 2048

ADD /scripts/ /opt/scripts/
RUN chmod -R 770 /opt/scripts/

#Server Start
ENTRYPOINT ["/opt/scripts/start.sh"]

compose.yaml:

services: 
 tower-unite: 
   build: . 
   container_name: tower-unite 
   restart: always 
   ports: 
      - 7777:7777/udp 
      - 7778:7778/udp 
      - 27015:27015 
      - 27015:27015/udp 
   volumes: 
      - /mnt/user/appdata/towerunite-destinyisland/serverdata/serverfiles 
   env_file: .env 
networks: {}

scripts/start.sh:

#!/bin/bash 
echo "---Ensuring UID: ${UID} matches user---" 
usermod -u ${UID} ${USER} 
echo "---Ensuring GID: ${GID} matches user---" 
groupmod -g ${GID} ${USER} > /dev/null 2>&1 ||: 
usermod -g ${GID} ${USER} 
echo "---Setting umask to ${UMASK}---" 
umask ${UMASK} 

echo "---Checking for optional scripts---" 
cp -f /opt/custom/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||: 
cp -f /opt/scripts/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||: 

if [ -f /opt/scripts/start-user.sh ]; then 
   echo "---Found optional script, executing---" 
   chmod -f +x /opt/scripts/start-user.sh ||: 
   /opt/scripts/start-user.sh || echo "---Optional Script has thrown an Error---" 
else 
   echo "---No optional script found, continuing---" 
fi 

echo "---Taking ownership of data...---" 
chown -R root:${GID} /opt/scripts 
chmod -R 750 /opt/scripts 
chown -R ${UID}:${GID} ${DATA_DIR} 

echo "---Starting...---" 
term_handler() { 
       kill -SIGTERM "$killpid" 
       wait "$killpid" -f 2>/dev/null 
       exit 143; 
} 

trap 'kill ${!}; term_handler' SIGTERM 
su ${USER} -c "/opt/scripts/start-server.sh" & 
killpid="$!" 
while true 
do 
       wait $killpid 
       exit 0; 
done 

scripts/start-server.sh

#!/bin/bash 
echo "---Validate Directories---" 
if [ ! -d ${DATA_DIR} ]; then 
   echo "DATA_DIR not found!" 
   mkdir -p ${DATA_DIR} 
   if [ ! -d ${DATA_DIR} ]; then 
       echo "DATA_DIR Creation Failed!" 
   else 
       echo "DATA_DIR Created Successfully." 
   fi 
else 
   echo "DATA_DIR Verified." 
fi 
if [ ! -d ${STEAMCMD_DIR} ]; then 
   echo "STEAMCMD_DIR not found!" 
   mkdir -p ${STEAMCMD_DIR} 
   if [ ! -d ${STEAMCMD_DIR} ]; then 
       echo "STEAMCMD_DIR Creation Failed!" 
   else 
       echo "STEAMCMD_DIR Created Successfully." 
   fi 
else 
   echo "STEAMCMD_DIR Verified." 
fi 
if [ ! -d ${SERVER_DIR} ]; then 
   echo "SERVER_DIR not found!" 
   mkdir -p ${SERVER_DIR} 
   if [ ! -d ${SERVER_DIR} ]; then 
       echo "SERVER_DIR Creation Failed!" 
   else 
       echo "SERVER_DIR Created Successfully." 
   fi 
else 
   echo "SERVER_DIR Verified." 
fi 

echo "---Validate SteamCMD---" 
if [ ! -f ${STEAMCMD_DIR}/steamcmd.sh ]; then 
   echo "SteamCMD not found!" 
   wget -q -O ${STEAMCMD_DIR}/steamcmd_linux.tar.gz https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz 
   if [ ! -f ${STEAMCMD_DIR}/steamcmd_linux.tar.gz ]; then 
       echo "Downloading SteamCMD has FAILED!" 
   else 
       echo "SteamCMD downloaded successfully." 
   fi 
   tar --directory ${STEAMCMD_DIR} -xvzf ${STEAMCMD_DIR}/steamcmd_linux.tar.gz 
   rm ${STEAMCMD_DIR}/steamcmd_linux.tar.gz 
fi 

echo "---Update SteamCMD---" 
if [ "${USERNAME}"  "" ]; then 
   ${STEAMCMD_DIR}/steamcmd.sh \ 
   +login anonymous \ 
   +quit 
else 
   ${STEAMCMD_DIR}/steamcmd.sh \ 
   +login ${USERNAME} ${PASSWRD} \ 
   +quit 
fi 

echo "---Update Server---" 
if [ "${USERNAME}"  "" ]; then 
   if [ "${VALIDATE}" == "true" ]; then 
       echo "---Validating installation---" 
       ${STEAMCMD_DIR}/steamcmd.sh \ 
       +force_install_dir ${SERVER_DIR} \ 
       +login anonymous \ 
       +app_update ${GAME_ID} validate \ 
       +quit 
   else 
       ${STEAMCMD_DIR}/steamcmd.sh \ 
       +force_install_dir ${SERVER_DIR} \ 
       +login anonymous \ 
       +app_update ${GAME_ID} \ 
       +quit 
   fi 
else 
   if [ "${VALIDATE}" == "true" ]; then 
       echo "---Validating installation---" 
       ${STEAMCMD_DIR}/steamcmd.sh \ 
       +force_install_dir ${SERVER_DIR} \ 
       +login ${USERNAME} ${PASSWRD} \ 
       +app_update ${GAME_ID} validate \ 
       +quit 
   else 
       ${STEAMCMD_DIR}/steamcmd.sh \ 
       +force_install_dir ${SERVER_DIR} \ 
       +login ${USERNAME} ${PASSWRD} \ 
       +app_update ${GAME_ID} \ 
       +quit 
   fi 
fi 

echo "---Prepare Server---" 
if [ ! -f ${DATA_DIR}/.steam/sdk32/steamclient.so ]; then 
       if [ ! -d ${DATA_DIR}/.steam ]; then 
       mkdir ${DATA_DIR}/.steam 
   fi 
       if [ ! -d ${DATA_DIR}/.steam/sdk32 ]; then 
       mkdir ${DATA_DIR}/.steam/sdk32 
   fi 
   cp -R ${STEAMCMD_DIR}/linux32/* ${DATA_DIR}/.steam/sdk32/ 
fi 
chmod -R ${DATA_PERM} ${DATA_DIR} 

cp ${SERVER_DIR}/linux64/steamclient.so ${SERVER_DIR}/Tower/Binaries/Linux/steamclient.so 

echo "---Server ready---" 

echo "---Start Server---" 
cd ${SERVER_DIR} 
${SERVER_DIR}/Tower/Binaries/Linux/TowerServer-Linux-Shipping ${GAME_MAP} -log -nosteamclient -Port=${GAME_PORT} -QueryPort=${QUERY_PORT} ${GAME_PARAMS} 
#${SERVER_DIR}/Tower/Binaries/Linux/TowerServer-Linux-Shipping ${GAME_MAP} -log -nosteamclient -Port=${GAME_PORT} -QueryPort=${QUERY_PORT} -TowerServerINI=${GAME_INI}  ${GAME_PARAMS} # commented out because when provided it will only look relative to the executable

Especially given I cobbled it together, I figured it being present would likely only help. Thanks for your time as well, its much appreciated!

  • Community Expert
  • Solution
4 hours ago, Mesmerus said:

Soooo any tips on how I might go about changing the config so data isn't stored in RAM

Map any cache directories it's using to a disk, /tmp is a common one. If it's a game server, you'll probably just need to throw more RAM at it, turn off other services while it's running, or use the swap plugin

  • Author

All directories the container uses are under that master /serverfiles/ directory, which is in turn mounted to a share; there shouldn't be any cache directories, as far as I'm aware 🤔 I'll map /tmp just to be safe, can't imagine it'd hurt anything.

Also I don't believe I've restricted memory for docker itself anyhow, nor for the container, but this server only has 24G installed. So I guess I'll have a look at the swap plugin if mounting /tmp to the share doesn't resolve this, and I can't find any other cache directories.

I have a script set up to auto restart it which would help too, but I've had to toggle that off due to a bug in the game about two months back; it doesn't re-enable a setting when it restarts for now. I'd wager that was probably masking this issue, rebooting the container before it got to the point of running the server out of memory!

Thanks for looking into this for me, appreciate all the pointers!

  • Author

You called it - the actual binary the game server is creating to run, TowerServer-Linux-Shipping was being lobbed under /tmp! And without that explicitly mapped, it was sitting in cache.

I've also added an extra parameter for --memory 8g just to be safe. Although honestly looking at the stats, I think even that is too much, it wasn't actually a memory issue, it was the game server creating the binary outside of the directories I defined. Figures as much, and again, I very much appreciate your insight!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.