Author Topic: Dedicated server instance is crashing  (Read 5527 times)

Filip

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Dedicated server instance is crashing
« on: December 06, 2013, 08:37:21 AM »
I have been playing around with the dedicated server exe file (TNServer.exe), and I noticed that it sometimes crashes if you abruptly terminates a client. Does this mean that it is pretty easy to crash the server from client-side, or can I adjust the server to "catch all" and ignore any client miss-usages, so that it crash less or preferably not at all?

pyscho2day

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 74
    • View Profile
Re: Dedicated server instance is crashing
« Reply #1 on: December 06, 2013, 11:00:43 AM »
I have a lobby server running in the cloud and it has been on for a very long time and have yet to crash it.  This includes killing the client and leaving everything open.  Are you using it as the Game server or a Lobby server?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dedicated server instance is crashing
« Reply #2 on: December 07, 2013, 12:43:15 AM »
I have two servers active for Starlink on an Amazon EC2 -- lobby, and actual game server. Both have been up for the past 5 months straight with players coming and going all the time. That's a Windows instance though. What OS are you running?

Filip

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: Dedicated server instance is crashing
« Reply #3 on: December 07, 2013, 09:20:52 AM »
I am running Windows 7. After setting the "update per second"-limit in my position sync, I have not encountered the problem again. I was probably DoS-attacking myself. Still I think it should be able to handle 100 packets/ second (If 10 people are simultanously connected sending 10 packets / second). And the problem came in when I terminated the client, so perhaps (just brainstorming) the server crashed because it was disrupted in too many TCP package handshakes.

Using it as a gameserver

gg67

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 66
    • View Profile
Re: Dedicated server instance is crashing
« Reply #4 on: January 22, 2014, 03:20:17 PM »
Having a similar issue. Server has been up for weeks without issues and did a stress test with only 20 users. Server crashed twice, with this output:

  1. 96.225.129.74:55585 has connected
  2. 70.193.205.205:35441 has timed out
  3. 70.193.205.205:35441 has disconnected
  4. 109.79.247.115:58930 has disconnected
  5. ERROR (ProcessPlayerPacket): An attempt was made to move the position before the
  6.  beginning of the stream.
  7. 24.101.136.87:6361 has disconnected
  8. 98.203.252.175:63934 has timed out
  9. 98.203.252.175:63934 has disconnected
  10.  
  11. Unhandled Exception: System.ArgumentOutOfRangeException: Non-negative number req
  12. uired.
  13. Parameter name: count
  14.    at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
  15.    at System.IO.BinaryWriter.Write(Byte[] buffer, Int32 index, Int32 count)
  16.    at TNet.TcpProtocol.ProcessBuffer(Int32 bytes) in c:\Users\Graham\Developer\T
  17. NetServer\Assets\TNet\Common\TNTcpProtocol.cs:line 623
  18.    at TNet.TcpProtocol.OnReceive(IAsyncResult result) in c:\Users\Graham\Develop
  19. er\TNetServer\Assets\TNet\Common\TNTcpProtocol.cs:line 548
  20.    at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
  21.    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
  22. ontextCallback callback, Object state)
  23.    at System.Net.ContextAwareResult.Complete(IntPtr userToken)
  24.    at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr u
  25. serToken)
  26.    at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32
  27.  errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
  28.    at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32
  29. errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

Can you make any sense of it? I'm using the stock server executable (though I changed the version numbers) on a Windows 7 instance.

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dedicated server instance is crashing
« Reply #5 on: January 23, 2014, 07:24:06 AM »
It looks like in your case 'mExpected + 4' ends up negative... which implies that 'mExpected' is invalid -- which points up at line 589:
  1. mExpected = mReceiveBuffer.PeekInt(mOffset);
Try changing that section to be:
  1.                         // Figure out the expected size of the packet
  2.                         if (mExpected == 0)
  3.                         {
  4.                                 mExpected = mReceiveBuffer.PeekInt(mOffset);
  5.  
  6.                                 if (mExpected < 0 || mExpected > 16777216)
  7.                                 {
  8.                                         Close(true);
  9.                                         return false;
  10.                                 }
  11.                         }
...still, I'd be curious to know how you got to that state and what 'mExpected' ends up being for you.