Jump to content

[41.61] [Multiplayer] Anonymous Server branch cannot set JVM Args.


Renegade Master

Recommended Posts

Version?

  • legacy41_61 and public

 

Singleplayer/Multiplayer? 

  • Multiplayer

 

Host or dedicated? 

  • Dedicated

 

Mods?

  • No

 

Reproduction steps:

 

legacy41_61 branch:

  1. Download the server software using SteamCMD
    // Set the game installation directory
    force_install_dir /home/steam/ZomboidDedicatedServer
    
    login anonymous
    
    // Install/Update the Zomboid Dedicated Server
    app_update 380870 -beta legacy41_61 validate
    
    quit

     

  2. Attempt to set the maximum JVM RAM to 6 GiB using the `start-server.sh` file.
    #!/bin/bash
    #
    ###############################################################################
    
    INSTDIR="`dirname $0`" ; cd "${INSTDIR}" ; INSTDIR="`pwd`"
    
    if "${INSTDIR}/jre64/bin/java" -version > /dev/null 2>&1; then
            echo "64-bit java detected"
            export PATH="${INSTDIR}/jre64/bin:$PATH"
            export LD_LIBRARY_PATH="${INSTDIR}/linux64:${INSTDIR}/natives:${INSTDIR}:${INSTDIR}/jre64/lib/amd64:${LD_LIBRARY_PATH}"
            JSIG="libjsig.so"
            LD_PRELOAD="${LD_PRELOAD}:${JSIG}" ./ProjectZomboid64 "$@"
    elif "${INSTDIR}/jre/bin/java" -client -version > /dev/null 2>&1; then
            echo "32-bit java detected"
            export PATH="${INSTDIR}/jre/bin:$PATH"
            export LD_LIBRARY_PATH="${INSTDIR}/linux32:${INSTDIR}/natives:${INSTDIR}:${INSTDIR}/jre/lib/i386:${LD_LIBRARY_PATH}"
            JSIG="libjsig.so"
            LD_PRELOAD="${LD_PRELOAD}:${JSIG}" ./ProjectZomboid32 "$@"
    else
            echo "couldn't determine 32/64 bit of java"
    fi
    exit 0
    
    
    
    
    JARPATH="java/:java/lwjgl.jar:java/lwjgl_util.jar:java/sqlite-jdbc-3.27.2.1.jar:java/uncommons-maths-1.2.3.jar"
    
    LD_PRELOAD=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/libjsig.so \
    java \
            -Dzomboid.steam=1 -Dzomboid.znetlog=1 \
            -Djava.library.path="${INSTDIR}/natives:${INSTDIR}/linux64" \
            -Xms2048m \
            -Xmx6144m \ # <-- SETTING MAX JVM RAM. COMMENT ONLY FOR THIS REPORT
            -XX:-UseSplitVerifier \
            -cp "${JARPATH}" \
            zombie.network.GameServer \
            "$@"
    
    exit 0
    
    #
    # EOF
    #
    ###############################################################################

     

  3. Run the server by running the above modified file.
  4. Observe that the server is only ever allocated 2048 MiB of RAM from the server logs:
    64-bit java detected
    2021-12-27T19:02:39.822048743Z ERROR: ld.so: object 'libjsig.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
    2021-12-27T19:02:39.823315370Z ERROR: ld.so: object 'libjsig.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
    2021-12-27T19:02:40.113207134Z pzexe: looking for PZXInitThreads.so
    2021-12-27T19:02:40.113239104Z pzexe: libPZXInitThreads64.so was not found. This is ok for a server, but multi-core rendering won't work on a client without it.
    2021-12-27T19:02:40.113243294Z pzexe: about to run java hack to locate libjvm.so...
    2021-12-27T19:02:40.113245633Z pzexe: executing "java -classpath pzexe.jar -Djava.library.path=. zombie.pzexe"
    2021-12-27T19:02:40.113247743Z pzexe.java: loading shared library "pzexe_jni64"
    2021-12-27T19:02:40.113249823Z JVM=/home/steam/ZomboidDedicatedServer/jre64/lib/server/libjvm.so
    2021-12-27T19:02:40.113251893Z pxexe: /proc/self/exe=/home/steam/ZomboidDedicatedServer/ProjectZomboid64
    2021-12-27T19:02:40.113253853Z pzexe config file: /home/steam/ZomboidDedicatedServer/ProjectZomboid64.json
    2021-12-27T19:02:40.113255813Z pzexe: mainClass: zombie/network/GameServer
    2021-12-27T19:02:40.113259723Z pzexe: classpath: -Djava.class.path=java/.:java/istack-commons-runtime.jar:java/jassimp.jar:java/javacord-2.0.17-shaded.jar:java/javax.activation-api.jar:java/jaxb-api.jar:java/jaxb-runtime.jar:java/lwjgl.jar:java/lwjgl-natives-linux.jar:java/lwjgl-glfw.jar:java/lwjgl-glfw-natives-linux.jar:java/lwjgl-jemalloc.jar:java/lwjgl-jemalloc-natives-linux.jar:java/lwjgl-opengl.jar:java/lwjgl-opengl-natives-linux.jar:java/lwjgl_util.jar:java/sqlite-jdbc-3.27.2.1.jar:java/trove-3.0.3.jar:java/uncommons-maths-1.2.3.jar
    2021-12-27T19:02:40.113272723Z pzexe: vmArg (json) 1: -Djava.awt.headless=true
    2021-12-27T19:02:40.113274763Z pzexe: vmArg (json) 2: -Xms2048m
    2021-12-27T19:02:40.113276663Z pzexe: vmArg (json) 3: -Xmx2048m # <-- JVM Max RAM set to 2 GiB
    2021-12-27T19:02:40.113278493Z pzexe: vmArg (json) 4: -Dzomboid.steam=1
    2021-12-27T19:02:40.113280423Z pzexe: vmArg (json) 5: -Dzomboid.znetlog=1
    2021-12-27T19:02:40.113282443Z pzexe: vmArg (json) 6: -Djava.library.path=linux64/:natives/
    2021-12-27T19:02:40.113284453Z pzexe: vmArg (json) 7: -Djava.security.egd=file:/dev/urandom
    2021-12-27T19:02:40.113286373Z pzexe: vmArg (json) 8: -XX:+UseZGC
    2021-12-27T19:02:40.113288333Z pzexe: vmArg (json) 9: -XX:-OmitStackTraceInFastThrow
    2021-12-27T19:02:40.113290233Z pzexe: using jvm "/home/steam/ZomboidDedicatedServer/jre64/lib/server/libjvm.so"
    2021-12-27T19:02:40.246246444Z DEBUG: General     , 1640631760224> 11,601,441> LoggerManager.init                  > Initializing...
    2021-12-27T19:02:40.262681331Z LOG  : General     , 1640631760262> 11,601,469> cachedir set to "/home/steam/Zomboid"

     

  5. Server then crashes when attempting to use more than 2GiB of RAM.

 

public branch:

  1. Download the server software using SteamCMD
    // Set the game installation directory
    force_install_dir /home/steam/ZomboidDedicatedServer
    
    login anonymous
    
    // Install/Update the Zomboid Dedicated Server
    app_update 380870 -beta public validate
    
    quit

     

  2. Attempt to set the maximum JVM RAM to 6 GiB using the `start-server.sh` file.
     
  3. Discover during the previous step that those settings don't exist.
    #!/bin/bash
    #
    ###############################################################################
    #
    # Edit memory option -Xmx2048m \
    #   or ProjectZomboid32.json for 32bit servers (rare)
    #
    ############
    
    INSTDIR="`dirname $0`" ; cd "${INSTDIR}" ; INSTDIR="`pwd`"
    
    if "${INSTDIR}/jre64/bin/java" -version > /dev/null 2>&1; then
        echo "64-bit java detected"
        export PATH="${INSTDIR}/jre64/bin:$PATH"
        export LD_LIBRARY_PATH="${INSTDIR}/linux64:${INSTDIR}/natives:${INSTDIR}:${INSTDIR}/jre64/lib/amd64:${LD_LIBRARY_PATH}"
        JSIG="libjsig.so"
        LD_PRELOAD="${LD_PRELOAD}:${JSIG}" ./ProjectZomboid64 "$@"
    elif "${INSTDIR}/jre/bin/java" -client -version > /dev/null 2>&1; then
        echo "32-bit java detected"
        export PATH="${INSTDIR}/jre/bin:$PATH"
        export LD_LIBRARY_PATH="${INSTDIR}/linux32:${INSTDIR}/natives:${INSTDIR}:${INSTDIR}/jre/lib/i386:${LD_LIBRARY_PATH}"
        JSIG="libjsig.so"
        LD_PRELOAD="${LD_PRELOAD}:${JSIG}" ./ProjectZomboid32 "$@"
    else
        echo "couldn't determine 32/64 bit of java"
    fi
    exit 0
    
    #
    # EOF
    #
    ###############################################################################

     

My workaround has been to also modify the `ProjectZomboid64.json` file when running the server on the `legacy41_61` branch. This makes the following appear in the startup logs, which is more promising:

64-bit java detected
2021-12-27T19:12:19.557328533Z ERROR: ld.so: object 'libjsig.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
2021-12-27T19:12:19.559820144Z ERROR: ld.so: object 'libjsig.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
2021-12-27T19:12:19.867248885Z pzexe: looking for PZXInitThreads.so
2021-12-27T19:12:19.867269414Z pzexe: libPZXInitThreads64.so was not found. This is ok for a server, but multi-core rendering won't work on a client without it.
2021-12-27T19:12:19.867278364Z pzexe: about to run java hack to locate libjvm.so...
2021-12-27T19:12:19.867280034Z pzexe: executing "java -classpath pzexe.jar -Djava.library.path=. zombie.pzexe"
2021-12-27T19:12:19.867281524Z pzexe.java: loading shared library "pzexe_jni64"
2021-12-27T19:12:19.867282984Z JVM=/home/steam/ZomboidDedicatedServer/jre64/lib/server/libjvm.so
2021-12-27T19:12:19.867284324Z pxexe: /proc/self/exe=/home/steam/ZomboidDedicatedServer/ProjectZomboid64
2021-12-27T19:12:19.867285654Z pzexe config file: /home/steam/ZomboidDedicatedServer/ProjectZomboid64.json
2021-12-27T19:12:19.867286934Z pzexe: mainClass: zombie/network/GameServer
2021-12-27T19:12:19.867289424Z pzexe: classpath: -Djava.class.path=java/.:java/istack-commons-runtime.jar:java/jassimp.jar:java/javacord-2.0.17-shaded.jar:java/javax.activation-api.jar:java/jaxb-api.jar:java/jaxb-runtime.jar:java/lwjgl.jar:java/lwjgl-natives-linux.jar:java/lwjgl-glfw.jar:java/lwjgl-glfw-natives-linux.jar:java/lwjgl-jemalloc.jar:java/lwjgl-jemalloc-natives-linux.jar:java/lwjgl-opengl.jar:java/lwjgl-opengl-natives-linux.jar:java/lwjgl_util.jar:java/sqlite-jdbc-3.27.2.1.jar:java/trove-3.0.3.jar:java/uncommons-maths-1.2.3.jar
2021-12-27T19:12:19.867292204Z pzexe: vmArg (json) 1: -Djava.awt.headless=true
2021-12-27T19:12:19.867293544Z pzexe: vmArg (json) 2: -Xms2048m
2021-12-27T19:12:19.867294844Z pzexe: vmArg (json) 3: -Xmx6144m # <-- JVM Max RAM set to 6 GiB
2021-12-27T19:12:19.867296104Z pzexe: vmArg (json) 4: -Dzomboid.steam=1
2021-12-27T19:12:19.867297384Z pzexe: vmArg (json) 5: -Dzomboid.znetlog=1
2021-12-27T19:12:19.867298704Z pzexe: vmArg (json) 6: -Djava.library.path=linux64/:natives/
2021-12-27T19:12:19.867299954Z pzexe: vmArg (json) 7: -Djava.security.egd=file:/dev/urandom
2021-12-27T19:12:19.867301214Z pzexe: vmArg (json) 8: -XX:+UseZGC
2021-12-27T19:12:19.867302484Z pzexe: vmArg (json) 9: -XX:-OmitStackTraceInFastThrow
2021-12-27T19:12:19.867303784Z pzexe: using jvm "/home/steam/ZomboidDedicatedServer/jre64/lib/server/libjvm.so"
2021-12-27T19:12:20.022810780Z DEBUG: General     , 1640632340001> 12,181,218> LoggerManager.init                  > Initializing...
2021-12-27T19:12:20.041868979Z LOG  : General     , 1640632340041> 12,181,248> cachedir set to "/home/steam/Zomboid"

I have also verified that in the above configuration, the server can happily exceed the 2GiB RAM limit.

 

I was informed that a "logged in" Steam user downloads a different `start-server.sh` file to the one that a dedicated server receives.  I believe that a user hosting the server from within the game (non-dedicated) receives the following `start-server.sh`:

#!/bin/bash

INSTDIR="`dirname $0`" ; cd "${INSTDIR}" ; INSTDIR="`pwd`"
JARPATH="./:./istack-commons-runtime.jar:./jassimp.jar:./javacord-2.0.17-shaded.jar:./javax.activation-api.jar:./jaxb-api.jar:./jaxb-runtime.jar:./lwjgl.jar:./lwjgl-natives-linux.jar:./lwjgl-glfw.jar:./lwjgl-glfw-natives-linux.jar:./lwj>

if "${INSTDIR}/jre64/bin/java" -version > /dev/null 2>&1; then
        echo "64-bit java detected"
        export PATH="${INSTDIR}/jre64/bin:$PATH"
        export LD_LIBRARY_PATH="${INSTDIR}/linux64:${INSTDIR}:${INSTDIR}/jre64/lib/amd64:${LD_LIBRARY_PATH}"
        JSIG="libjsig.so"
        LD_PRELOAD="${LD_PRELOAD}:${JSIG}" "${INSTDIR}/jre64/bin/java" \
                -cp "${JARPATH}" -Djava.awt.headless=true \
                -Xms2048m -Xmx2048m -XX:+UseZGC \
                -Dzomboid.steam=1 -Dzomboid.znetlog=1 \
                -Djava.library.path=linux64/:./ \
                -XX:-OmitStackTraceInFastThrow -Djava.security.egd=file:/dev/urandom \
                zombie/network/GameServer "$@"
elif "${INSTDIR}/jre/bin/java" -client -version > /dev/null 2>&1; then
        echo "32-bit java detected"
        export PATH="${INSTDIR}/jre/bin:$PATH"
        export LD_LIBRARY_PATH="${INSTDIR}/linux32:${INSTDIR}:${INSTDIR}/jre/lib/i386:${LD_LIBRARY_PATH}"
        JSIG="libjsig.so"
        LD_PRELOAD="${LD_PRELOAD}:${JSIG}" "${INSTDIR}/jre/bin/java" -client \
                -cp "${JARPATH}" -Djava.awt.headless=true \
                -Xms768m -Xmx768m \
                -Dzomboid.steam=0 -Dzomboid.znetlog=1 \
                -Djava.library.path=linux32/:./ \
                -XX:-OmitStackTraceInFastThrow -Djava.security.egd=file:/dev/urandom  \
                zombie/network/GameServer "$@"
else
        echo "couldn't determine 32/64 bit of java"
fi
exit 0

This is quite different to the one I am served on the `public` branch.

 

Can you investigate whether "logged in" Steam users hosting non-dedicated servers are being distributed different files to dedicated servers downloading using the 'Steam anonymous user'?

aaa

 

Edited by Renegade Master
Change syntax highlighting of a Bash file.
Link to comment
Share on other sites

Use the json file to set parameters for the exes, which the script calls. None of the stuff after exit 0 is reached. It was removed in subsequent versions. 

 

Build 61 doesn't include many fixes and should not be used.

 

Anonymous should always be used for the dedicated server package. Very odd that the scripts are different.

Link to comment
Share on other sites

Thank you for getting back to me.

I was so busy reading the JVM args, that I honestly didn't notice that sneaky `exit 0` in between the calls.

So your suggested approach for altering JVM args is via the JSON files? 
I will make sure to update my image with that.

 

Thanks again, and happy holidays!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...