Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: voncarp on October 25, 2014, 07:57:00 PM

Title: tnet server crashing
Post by: voncarp on October 25, 2014, 07:57:00 PM
I have run tnet server with pretty good success on my mac and on a server.  But, recently I can't get it to work on my server, yet it still works on my mac.  The only thing I can think of that is different is that on my server I now have multiple IP addresses.

Thoughts?

Here is a event log

- System

  - Provider

   [ Name]  Windows Error Reporting
 
  - EventID 1001

   [ Qualifiers]  0
 
   Level 4
 
   Task 0
 
   Keywords 0x80000000000000
 
  - TimeCreated

   [ SystemTime]  2014-10-26T00:36:44.000000000Z
 
   EventRecordID 2059
 
   Channel Application
 
   Computer TestServer
 
   Security
 
 - EventData
     
   0
   CLR20r3
   Not available
   0
   tnserver.exe
   0.0.0.0
   542958e0
   System
   2.0.0.0
   53a1215e
   2d68
   8a
   System.Net.Sockets.Socket
   
   AppCrash_tnserver.exe_a485a8ddb813bb31e56341639471b4a9fea32bd7_0957d3e2
   
   0
   265849bc-5ca8-11e4-93fc-80ee73361af2
   2048
Title: Re: tnet server crashing
Post by: MCoburn on October 26, 2014, 07:32:24 PM
That's not exactly the best report... what were you doing before it crashed? Did the binary show a console screen and then just die?
Title: Re: tnet server crashing
Post by: voncarp on October 26, 2014, 08:17:13 PM
I just run it.  Have any thoughts on how I can provide more info related to the crash?

I have run it on this server before when I had one IP address.  I reset/reprovision the server and re-uploaded the unzipped files.  I unzipped the files and run the .exe.  And now it crashes as in the picture every time I attempt to open it.  Windows server 2012. The only difference I can think of between my initial settings of what I originally had and currently have is that I have more than one IP address for the server.

I can run it on my Mac no problem. 


 
(https://dl.dropboxusercontent.com/u/78828827/Screen%20Shot%202014-10-26%20at%203.08.26%20PM.png)
Title: Re: tnet server crashing
Post by: ArenMook on October 26, 2014, 09:39:04 PM
Can you launch it in debug mode (ie: from monodevelop or visual studio after opening the solution file for the server?)
Title: Re: tnet server crashing
Post by: voncarp on October 26, 2014, 10:26:58 PM
Any of this relevant?

System.Net.Sockets.Socket.SetSocketOption (optionLevel=System.Net.Sockets.SocketOptionLevel.IP, optionName=System.Net.Sockets.SocketOptionName.AddMembership, optionValue={System.Net.Sockets.MulticastOption}) in C:\cygwin\sources\mono\mcs\class\System\System.Net.Sockets\Socket.cs:2076
TNet.UdpProtocol.Start (port=5129) in
TNet.UdpLobbyServer.Start (listenPort=5129) in
ServerMain.Start (name="TNet Server", tcpPort=5127, udpPort=5128, lobbyAddress=(null), lobbyPort=5129, useTcp=false) in
ServerMain.Main (args={string[7]}) in

 (https://dl.dropboxusercontent.com/u/78828827/Screen%20Shot%202014-10-26%20at%205.21.49%20PM.png)

 (https://dl.dropboxusercontent.com/u/78828827/Screen%20Shot%202014-10-26%20at%205.21.58%20PM.png)
Title: Re: tnet server crashing
Post by: MCoburn on October 27, 2014, 12:40:25 AM
Try:

  1. <path to exe> -ip:<use first IP of server>
  2.  

I had a issue with this on my Linux 3 IP server box. Tnet would start up but then crash with a exception.
Why are you using cygwin??
Title: Re: tnet server crashing
Post by: voncarp on October 27, 2014, 02:42:22 AM
Ah.  That did stop it from crashing.

Any suggestions what I need to check next?  Before I had multiple IPs, everything worked fine and UPnP did its job.  Now, no Gateway IP and UPnP fails. 

I do notice -ip use for either address still only offers the second IP address for the External IP.

Would you have any more suggestions?

(https://dl.dropboxusercontent.com/u/78828827/Screen%20Shot%202014-10-26%20at%209.34.08%20PM.png)
Title: Re: tnet server crashing
Post by: MCoburn on October 27, 2014, 10:58:58 PM
Ah.  That did stop it from crashing.

Any suggestions what I need to check next?  Before I had multiple IPs, everything worked fine and UPnP did its job.  Now, no Gateway IP and UPnP fails. 

I do notice -ip use for either address still only offers the second IP address for the External IP.

Would you have any more suggestions?

(https://dl.dropboxusercontent.com/u/78828827/Screen%20Shot%202014-10-26%20at%209.34.08%20PM.png)

Sorry, I made a typo. When you do the IP business, remove the use part of the ip parameter. So you should just get like server.exe -ip 127.0.0.1 .
UPnP may/may not work depending if you're on Amazon stuffs. Not sure about the gateway part tho. UPnP is only for auto-portmapping and isn't really essential if you've manually opened ports on firewalls.
Title: Re: tnet server crashing
Post by: ArenMook on October 29, 2014, 06:07:48 AM
Disassembly is not very useful, unfortunately. I need to know the line of code where it's crashing.
Title: Re: tnet server crashing
Post by: sberghici on November 08, 2014, 03:35:32 PM
Have the same problem. After upgrade from 1.9 to 2.01 server crashes on my VPS(Windows 2008R2).

Unhandled Exception: System.Net.Sockets.SocketException: An invalid argument was
 supplied
   at System.Net.Sockets.Socket.setMulticastOption(SocketOptionName optionName,
MulticastOption MR)
   at System.Net.Sockets.Socket.SetSocketOption(SocketOptionLevel optionLevel, S
ocketOptionName optionName, Object optionValue)
   at TNet.UdpProtocol.Start(Int32 port)
   at TNet.UdpLobbyServer.Start(Int32 listenPort)
   at ServerMain.Start(String name, Int32 tcpPort, Int32 udpPort, String lobbyAd
dress, Int32 lobbyPort, Boolean useTcp)
   at ServerMain.Main(String[] args)
Title: Re: tnet server crashing
Post by: ArenMook on November 09, 2014, 09:42:14 PM
Launch it without UDP, and it won't be trying to use multicasting.

TNServer -tcp 5127
Title: Re: tnet server crashing
Post by: sberghici on December 27, 2014, 07:41:51 AM
Crashes with "TNServer -tcp 5127" as well.

P.S. the same exception
Title: Re: tnet server crashing
Post by: ArenMook on December 27, 2014, 09:41:11 AM
What's the full string you use to launch TNet? In that screenshot you are using "-ip use xxxx" which is invalid. "use" should not be there.
Title: Re: tnet server crashing
Post by: sberghici on December 27, 2014, 12:14:56 PM
I used the following line:
"TNServer -tcp 5127"
I guess it was another guy who had "use" there.
I'm installing Visual Studio on my VPS to troubleshoot.
Title: Re: tnet server crashing
Post by: sberghici on December 28, 2014, 06:30:05 PM
Found it. The problem only happened if you have more then 1 network interface(in my case I have 3 on my VPS)
  1. mSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, opt);
Exception at TNUdpProtocol.cs line 114 after you try to set socket option for the second ip in the foreach loop.

It seems that microsoft allows only 1 IP per socket. You can easily reproduce this bug adding second network adapter to your pc. I've fixed it changing code to use default ip address from the command line:
  1.         public bool Start (int port)
  2.         {
  3.                 Stop();
  4.  
  5.                 mPort = port;
  6.                 mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
  7. // Use the default network interface if one wasn't explicitly chosen
  8. #if (UNITY_IPHONE && !UNITY_EDITOR) || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
  9.                 IPAddress networkInterface = useMulticasting ? multicastIP : (defaultNetworkInterface ?? IPAddress.Any);
  10. #else
  11.         IPAddress networkInterface = defaultNetworkInterface ?? IPAddress.Any;
  12. #endif
  13. #if !UNITY_WEBPLAYER
  14.                 // Web player doesn't seem to support broadcasts
  15.                 mSocket.MulticastLoopback = true;
  16.                 mMulticast = useMulticasting;
  17.  
  18.         if (useMulticasting)
  19.                 {
  20.             MulticastOption opt = new MulticastOption(multicastIP, networkInterface);
  21.             mSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, opt);
  22.                 }
  23.                 else mSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1);
  24. #endif
  25.                 // Port zero means we will be able to send, but not receive
  26.                 if (mPort == 0) return true;
  27.  
  28.                 try
  29.                 {
  30.  
  31.                         mEndPoint = new IPEndPoint(networkInterface, 0);
  32.                         mDefaultEndPoint = new IPEndPoint(networkInterface, 0);
  33.  
  34.                         // Bind the socket to the specific network interface and start listening for incoming packets
  35.                         mSocket.Bind(new IPEndPoint(networkInterface, mPort));
  36.                         mSocket.BeginReceiveFrom(mTemp, 0, mTemp.Length, SocketFlags.None, ref mEndPoint, OnReceive, null);
  37.                 }
  38.                
Title: Re: tnet server crashing
Post by: ArenMook on December 30, 2014, 02:54:15 PM
You should update your TNet...
Title: Re: tnet server crashing
Post by: sberghici on December 30, 2014, 05:44:38 PM
I'm pretty sure I have the latest 2.0.2
(http://w7callerid.com/Data/Sites/1/1.jpg)
Title: Re: tnet server crashing
Post by: ArenMook on December 31, 2014, 04:09:17 PM
Hmm... well, may be OS version related, because I work on Windows and I have two network addresses (hamachi + normal) and it's all working as expected in Win 8.1.
Title: Re: tnet server crashing
Post by: sberghici on January 02, 2015, 05:44:28 PM
Can you run under debugger and check if you get both IPs in the loop? I guess you just ignore VPN in your code, when get list of of adapters.
Title: Re: tnet server crashing
Post by: ArenMook on January 02, 2015, 10:11:03 PM
Yeah, seems to. Well, I can just wrap that section in a try/catch just to be safe.
Title: Re: tnet server crashing
Post by: decerto on January 22, 2015, 09:41:24 PM
Any fix on this? I have around 5+ IPs connected  and even if i use -ip it still results in a crash.

Cheers,
Title: Re: tnet server crashing
Post by: ArenMook on January 23, 2015, 10:03:55 PM
It's already wrapped in a try/catch block... did you update?