Author Topic: TNet Crashing  (Read 2856 times)

Doomlazy

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 1
  • Posts: 28
    • View Profile
TNet Crashing
« 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?

Ninja

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 21
    • View Profile
Re: TNet Crashing
« Reply #1 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNet Crashing
« Reply #2 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:
  1. try { Thread.Sleep(1); }
  2. catch (System.Threading.ThreadInterruptedException) { return; }
Re: line 490 that should just be removed, left it by accident -- thanks.

kamilion

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: TNet Crashing
« Reply #3 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.)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNet Crashing
« Reply #4 on: June 13, 2016, 05:33:10 AM »
:)

Doomlazy

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 1
  • Posts: 28
    • View Profile
Re: TNet Crashing
« Reply #5 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.
« Last Edit: June 13, 2016, 06:00:31 AM by Doomlazy »

Ninja

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 21
    • View Profile
Re: TNet Crashing
« Reply #6 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!