Author Topic: tnet server crashing  (Read 10737 times)

voncarp

  • Jr. Member
  • **
  • Thank You
  • -Given: 13
  • -Receive: 2
  • Posts: 91
    • View Profile
tnet server crashing
« 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

MCoburn

  • Jr. Member
  • **
  • Thank You
  • -Given: 1
  • -Receive: 7
  • Posts: 69
    • View Profile
Re: tnet server crashing
« Reply #1 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?

voncarp

  • Jr. Member
  • **
  • Thank You
  • -Given: 13
  • -Receive: 2
  • Posts: 91
    • View Profile
Re: tnet server crashing
« Reply #2 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. 


 

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: tnet server crashing
« Reply #3 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?)

voncarp

  • Jr. Member
  • **
  • Thank You
  • -Given: 13
  • -Receive: 2
  • Posts: 91
    • View Profile
Re: tnet server crashing
« Reply #4 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

 

 
« Last Edit: October 26, 2014, 10:38:44 PM by voncarp »

MCoburn

  • Jr. Member
  • **
  • Thank You
  • -Given: 1
  • -Receive: 7
  • Posts: 69
    • View Profile
Re: tnet server crashing
« Reply #5 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??

voncarp

  • Jr. Member
  • **
  • Thank You
  • -Given: 13
  • -Receive: 2
  • Posts: 91
    • View Profile
Re: tnet server crashing
« Reply #6 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?


MCoburn

  • Jr. Member
  • **
  • Thank You
  • -Given: 1
  • -Receive: 7
  • Posts: 69
    • View Profile
Re: tnet server crashing
« Reply #7 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?



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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: tnet server crashing
« Reply #8 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.

sberghici

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: tnet server crashing
« Reply #9 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)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: tnet server crashing
« Reply #10 on: November 09, 2014, 09:42:14 PM »
Launch it without UDP, and it won't be trying to use multicasting.

TNServer -tcp 5127

sberghici

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: tnet server crashing
« Reply #11 on: December 27, 2014, 07:41:51 AM »
Crashes with "TNServer -tcp 5127" as well.

P.S. the same exception
« Last Edit: December 27, 2014, 07:46:54 AM by sberghici »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: tnet server crashing
« Reply #12 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.

sberghici

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: tnet server crashing
« Reply #13 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.

sberghici

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: tnet server crashing
« Reply #14 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.