ryansheehan/terraria

Latest causes crash after world loads

clockwinder opened this issue ยท 11 comments

Used your container to successfully start and play Terraria on a server in early July. Today I went to set up a new server, so I checked for updates and pulled the new image.

Attempting to start a server with this new image causes a crash after pre-existing world file is loaded. Log below:

Click for Logs

Bootstrap:
world_file_name=World2.wld
configpath=/root/.local/share/Terraria/Worlds
logpath=/tshock/logs

Copying plugins...
cp: cannot stat '/plugins/*': No such file or directory
Environment WORLD_FILENAME specified
Loading to world World2.wld...
Error Logging Enabled.
TerrariaAPI Version: 2.1.0.0 (Protocol v1.4.2.3 (238), OTAPI 1.4.2.3)
[TShock] Info Config path has been set to /root/.local/share/Terraria/Worlds
[TShock] Info Log path has been set to /tshock/logs
TShock was improperly shut down. Please use the exit command in the future to prevent this.
TShock 4.5.5.0 (Olympics maybe?) now running.
AutoSave Enabled
Backups Enabled
Welcome to TShock for Terraria!
TShock comes with no warranty & is free software.
You can modify & distribute it under the terms of the GNU GPLv3.
[Server API] Info Plugin TShock v4.5.5.0 (by The TShock Team) initiated.
Terraria Server v1.4.2.3

Resetting game objects 1%
trimmed
Resetting game objects 100%
Loading world data: 1%
trimmed
Loading world data: 100%
Settling liquids 1%
trimmed
Settling liquids 50%
Terraria Server v1.4.2.3

Listening on port 7777
Type 'help' for a list of commands.

A password for this server was set in config.json and is being used.
Login before join enabled. Users may be prompted for an account specific password instead of a server password on connect.
Login using UUID enabled. Users automatically login via UUID.
A malicious server can easily steal a user's UUID. You may consider turning this option off if you run a public server.
TShock Notice: setup-code.txt is still present, and the code located in that file will be used.
To setup the server, join the game and type /setup 6396613
This token will display until disabled by verification. (/setup)
: Unhandled exception
System.UnhandledExceptionEventArgs
[Server API] Error

[Server API] Error An unhandled exception has occured in TSAPI, and a crash report will be generated
[Server API] Error Generating a crash report, please wait...
Server started
[Server API] Error Crash report saved at crash_132779474780038990.zip
[Server API] Error Please upload the crash file and report it at http://tshock.co/
[Server API] Error The process will terminate.
[Server API] Error

10/05/2021 16:44:38: Unhandled Exception
Thread: 8 [Server Input Thread]
Culture:
Exception: System.NullReferenceException: Object reference not set to an instance of an object
at Terraria.Main.startDedInputCallBack () [0x00017] in <13c7103e4994467dac3b7e479ef8edf5>:0
at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in :0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in :0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in :0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in :0
at System.Threading.ThreadHelper.ThreadStart () [0x00008] in :0

Saving world...
Saving world data: 1%
trimmed
Saving world data: 100%
trimmed
Validating world save: 98%
World saved.
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
at Terraria.Main.startDedInputCallBack () [0x00017] in <13c7103e4994467dac3b7e479ef8edf5>:0
at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in :0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in :0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in :0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in :0
at System.Threading.ThreadHelper.ThreadStart () [0x00008] in :0

So I went back and my previous server (early July), was still working, but if I point that server at the latest container, the same failure happens. I did notice that the log only states Settling liquids 50%, but I'm not sure that's relevant. Moving either of these servers back to tshock-1.4.2.3-4.5.4 solves the problem as well.

I apologize if this is just an error on my end, or with Tshock, but help would be appreciated regardless.

Looking at the logs, this looks like TShock threw the error. They may have changed something that made their save file incompatible? The only possibility from the container side is the version of mono that is running. Considering this release has been out for a few months, I think the issue is likely between TShock and your save file.

I also checked to see if there have been any new TShock releases, but there have not been.

Interesting, I tried the new container with the old save and a brand new save file; both failed in the same manner.

Since the version with tshock-1.4.2.3-4.5.4 worked before, I just put the new save file into that container and will stick with that for now. Thank you, and at least it's documented in case someone else runs into the issue as well.

I to have the issue!

Even with a clean world created.

Running

sudo docker run -it -p 7777:7777 --rm -v $HOME/terraria/world:/root/.local/share/Terraria/Worlds ryshe/terraria:latest -world /root/.local/share/Terraria/Worlds/theworld.wld -autocreate 3

Creates a World which does run and I can join the Server!

If I now stop the Server (gracefully) and use:

sudo docker run -d --rm -p 7777:7777 -v $HOME/terraria/world:/root/.local/share/Terraria/Worlds --name="terraria" -e WORLD_FILENAME=theworld.wld ryshe/terraria:latest

The Server starts but at Liquid 50% I get the same Error:

Settling liquids 50%
Terraria Server v1.4.3.2

Listening on port 7777
Type 'help' for a list of commands.

Login before join enabled. Users may be prompted for an account specific password instead of a server password on connect.
Login using UUID enabled. Users automatically login via UUID.
A malicious server can easily steal a user's UUID. You may consider turning this option off if you run a public server.
TShock Notice: setup-code.txt is still present, and the code located in that file will be used.
To setup the server, join the game and type /setup 2764149
This token will display until disabled by verification. (/setup)
: Unhandled exception
System.UnhandledExceptionEventArgs
[Server API] Error ===================================================================================
[Server API] Error An unhandled exception has occured in TSAPI, and a crash report will be generated
[Server API] Error Generating a crash report, please wait...
Server started
[Server API] Error Crash report saved at crash_132826986192957570.zip
[Server API] Error Please upload the crash file and report it at http://tshock.co/
[Server API] Error The process will terminate.
[Server API] Error ===================================================================================
================
11/29/2021 10:30:20 PM: Unhandled Exception
Thread: 8 [Server Input Thread]
Culture: en-US
Exception: System.NullReferenceException: Object reference not set to an instance of an object
  at Terraria.Main.startDedInputCallBack () [0x00017] in <9842ebc8cca741e8860a46b79d5c31ca>:0
  at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in <d13c8b563008422a8c5aaec0a74089cc>:0
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <d13c8b563008422a8c5aaec0a74089cc>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <d13c8b563008422a8c5aaec0a74089cc>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in <d13c8b563008422a8c5aaec0a74089cc>:0
  at System.Threading.ThreadHelper.ThreadStart () [0x00008] in <d13c8b563008422a8c5aaec0a74089cc>:0
================

I run this on a raspberry pi 4 8gb, earlier iterations of the image worked fine.

Yes I did add a discussion, thanks for the URL!
Sadly no answer yet, Pryaxis/TShock#2519 .

I got an answer, adding the -disable-commands to the bootstrap.sh for running an already created world works for me.

Is it possible to add this command for execution in a docker-compose without building the whole image myself?

I am using a docker-compose file and docker-compose up -d to run my services.
Adding a command did not work as this runs after the container is started as far as i know.

Thanks for your time!

For me, I was able to fix this by adding the disable-commands argument you mentioned in the docker-compose.yaml like so:

version: '3.3'
services:
  terraria:
    container_name: terraria
    image: ryshe/terraria:tshock-latest
    command:
      - '-disable-commands' # see: https://github.com/ryansheehan/terraria/issues/82
    ports:
      - '7777:7777'
    volumes:
      - '/opt/docker/Terraria/data:/root/.local/share/Terraria/Worlds:rw'
    environment:
      - WORLD_FILENAME=MyTerrariaWorld.wld
    logging:
      driver: 'json-file'
      options:
        max-file: '5'
        max-size: '10m'
    restart: unless-stopped

Bumped into this issue as well today. No new or old worlds are loaading at all.

Adding the -disable-commands makes the worlds load as mentioned above.

i had this same issue with the vanilla tag, setting the docker container to interactive by setting -dit instead of -d fixed it for me