Arqade Asked by user60561 on July 25, 2021
I’m running Terraria as a systemd service, with a service file like the following:
[Unit]
Description=server daemon for terraria
[Service]
User=terraria
Type=exec
RestartSec=10s
ExecStart=/opt/terraria/1412/TerrariaServer.bin.x86_64 -config /var/lib/terraria/config
ExecStop=/opt/terraria/bin/terrariad exit
ExecStop=/usr/bin/sh -c 'while kill -0 $MAINPID 2>/dev/null; do sleep 1; done'
TimeoutStopSec=10
[Install]
WantedBy=multi-user.target
Unfortunately, 5 minutes after starting the server, it crashes with this error:
Apr 15 18:13:40: [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
Apr 15 18:13:40: ================
Apr 15 18:13:40: at System.Threading.ThreadHelper.ThreadStart () [0x00008] in <d1664be62cd44600bbd25f7afa292479>:0
Apr 15 18:13:40: at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallba>
Apr 15 18:13:40: at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallba>
Apr 15 18:13:40: at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.Conte>
Apr 15 18:13:40: at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in <d1664be62cd44600bbd25f7afa292479>:0
Apr 15 18:13:40: at Terraria.Main.startDedInputCallBack () [0x00017] in <c62dec19bbe944969ce327cab98fe21b>:0
Apr 15 18:13:40: Exception: System.NullReferenceException: Object reference not set to an instance of an object
Apr 15 18:13:40: Culture: en-US
Apr 15 18:13:40: Thread: 6 [Server Input Thread]
Apr 15 18:13:40: 4/15/2021 6:13:40 PM: Unhandled Exception
Apr 15 18:13:40: : ================
Apr 15 18:13:40: Backing up world file
Apr 15 18:13:40: Validating world save: 87%
<snip>
Apr 15 18:08:45: : Server started
Apr 15 18:08:45: Type 'help' for a list of commands.
How do I avoid this crash?
The problem is that
The solution suggested there is to use screen
--which works! However, you lose all the logging to the systemd journal. So instead, you can use unbuffer
, which makes a TTY but also redirects the output to stdout. Use it like this:
ExecStart=/usr/bin/unbuffer /opt/terraria/1412/TerrariaServer.bin.x86_64 -config /var/lib/terraria/config
Answered by user60561 on July 25, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP