Support => TNet 3 Support => Topic started by: Doomlazy on June 12, 2016, 04:57:48 PM
Title: TNet Crashing
Post by: Doomlazy on June 12, 2016, 04:57:48 PM
When I use Application.Quit() while TNet is connecting to a server the built game crashes. How do I fix this?
Title: Re: TNet Crashing
Post by: Ninja on June 12, 2016, 06:59:07 PM
This may be unrelated to the OP, but TNServer.exe is crashing for me as well when entering q to exit.
Using TNet version 3.0.2
Line #568 in TNGameServer.cs: An unhandled exception of type 'System.Threading.ThreadInterruptedException' occurred in TNServer.exe Additional information: Thread was interrupted from a waiting state.
Another very small note: Line #490 in TNUPnP.cs needs to be commented out to build the server without the UnityEngine namespace.
Title: Re: TNet Crashing
Post by: ArenMook on June 12, 2016, 08:53:26 PM
Likely the same thing then? TNet just interrupts the thread using Interrupt() which is a perfectly legit way of doing it, which causes the thread to exit on the next Sleep() call. Are you on iOS/OSX? Anyway you can fix it just by wrapping the Thread.Sleep in a Try/catch block like so:
Re: line 490 that should just be removed, left it by accident -- thanks.
Title: Re: TNet Crashing
Post by: kamilion on June 13, 2016, 03:28:49 AM
Just noticed this was already fixed when I downloaded 3.0.2b, thanks for saving me the trouble. :) (Also, server now works fine on ODroid C1 ARM SoC and now cleanly shuts down, very nice.)
Title: Re: TNet Crashing
Post by: ArenMook on June 13, 2016, 05:33:10 AM
:)
Title: Re: TNet Crashing
Post by: Doomlazy on June 13, 2016, 05:44:14 AM
I have a different problem. I'm using TNet 2.1.1 and I'm on PC. When I open the game from the standalone .exe (Built game) and Use Application.Quit() after TNManager.Connect() but before it has connected successfully, the game crashes. I am not talking about TNServer.exe I mean the actual game crashes if I Quit while connecting.
Title: Re: TNet Crashing
Post by: Ninja on June 13, 2016, 05:49:38 AM
I'm using Windows 10 x64 as well as Raspbian Jesse and had the exception on both, but your update fixed the issue with TNServer.exe for me. Thanks!