TorchAPI / Torch

An extensible modding framework and improved client/DS for Space Engineers. Still a work in progress!
Apache License 2.0
146 stars 76 forks source link

Server doesn't properly crash when game init fails #220

Closed natepizzle closed 6 years ago

natepizzle commented 6 years ago

First, Torch has improved our lan gameplay tremendously. Kudos!!

I use a satellite connection out in rural america (no other broadband available) and torch/SE Dedi only connects to steam about half the time when the software randomly chooses to connect via a web socket. The tcp connect fails due to the way my provider has things setup. The issue is that torch Warns that a fatal error occurred instead of erroring and retrying. Then I have to close torch, reopen it, and wait for it to go through the steam connect stuff again hoping for a web socket connect.

Torch: Torch Version: v1.3.0.30-53-g2751eaf Torch: Game Version: 1.186.500 Keen: Environment.ProcessorCount: 8 Keen: Environment.OSVersion: Microsoft Windows 7 Ultimate (Microsoft Windows NT 6.1.7601 Service Pack 1) Keen: Environment.CommandLine: "D:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Tools\DedicatedServer\Torch.Server.exe" Keen: Environment.Is64BitProcess: True Keen: Environment.Is64BitOperatingSystem: True Keen: Environment.Version: 4.6.2 or later (461310) Keen: Environment.CurrentDirectory: D:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Tools\DedicatedServer Keen: CPU Info: AMD FX(tm)-8350 Eight-Core Processor
Keen-2018-03-24.log Torch-2018-03-24.log Keen: IntPtr.Size: 8

Expected Behavior

DS to connect to steam and successfully bind to ip address or fail and retry

Observed Behavior

ip bind failure and server halts

Steps to Reproduce

Will be hard to reproduce depending on your internet connection

Other Information

08:46:37.6967 [INFO] Torch: Initialized server 'Torch' at 'D:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Tools\DedicatedServer\Instance' 08:46:37.7097 [INFO] Torch: Starting server. 08:46:37.7337 [INFO] InstanceManager: Saved dedicated config. 08:46:38.7558 [INFO] InstanceManager: Saved world config. 08:46:39.5668 [INFO] Keen: Bind IP : 0.0.0.0:27016 08:46:52.8856 [INFO] Keen: Error: No IP assigned. 08:46:52.9956 [INFO] PatchManager: Patching begins... 08:46:52.9956 [INFO] PatchManager: Patching done 08:46:53.0266 [INFO] PatchManager: Patching begins... 08:46:53.0266 [INFO] PatchManager: Patching done 08:46:53.0266 [WARN] VRageGame: Failed to start sandbox game: fatal error during init

Jimmacle commented 6 years ago

First of all, thanks for providing all of the relevant logs/information right off the bat :P Second of all, unfortuntely this sounds like more of an issue with whatever other application is binding that port on your server. Can you change the port in Torch or that application to avoid conflicts?

natepizzle commented 6 years ago

The port isn't in use by any other application or server daemon. This issue isn't about the inability to connect. I can connect, I just have to terminate torch and try again. As soon as keen's side of things uses a web socket to connect to steam, my lan party is up and running until a restart of torch is needed. The issue is about torch recognizing the failing connection and hanging instead of failing and trying again. I am assuming that it should try to be a useful part of a server environment, isn't that the point of

14:09:57.8263 [INFO] Torch: Starting server watchdog.

Jimmacle commented 6 years ago

Torch doesn't connect to Steam any differently than the vanilla DS, in fact it uses the exact same code. Are you sure that there's nothing else on that port?

The watchdog is specifically used to detect a frozen server and forcefully crash the server so it can restart. It can't work if the game thread isn't already running or else it could time out before the server actually starts.

natepizzle commented 6 years ago

I'm certain there is nothing else using that port, my good ole buddy "netstat" told me, repeatedly. heh! I dumped gas and threw (a) torch on keen's app when I found out about your performance superiority over theirs. I just mean, this isn't a port battle between torch and keen if that is what you are implying. This "inability to connect" issue would fall under the purview of "a frozen server", correct? You have the ability to do something like this correct?

    if($keen->connected()) {
        run_torch();
    }
    else {
        $keen->connect();
    }
natepizzle commented 6 years ago

I had this same issue with keen, btw. It was easier to deal with as I could just push "Save & Start" after it failed to try again.

Jimmacle commented 6 years ago

The proper solution would be to stop catching the init failure in VRageGame so it throws a fatal error and makes the whole thing restart, I'll look into it soon.

natepizzle commented 6 years ago

Thank You, Thank You, Thank You.

Jimmacle commented 6 years ago

Should be fixed in Torch v1.3.0.32 f03bfd2d7a0cbc6853ba5c667b3d290bc2410cda