Author Topic: TnServer crashing  (Read 3277 times)

voncarp

  • Jr. Member
  • **
  • Thank You
  • -Given: 13
  • -Receive: 2
  • Posts: 91
    • View Profile
TnServer crashing
« on: June 29, 2015, 04:07:58 AM »
Unhandled Exception: System.InvalidOperationException: Queue empty.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resour
ce)
   at System.Collections.Generic.Queue`1.Dequeue()
   at TNet.TcpProtocol.OnSend(IAsyncResult result)
   at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
ontextCallback callback, Object state)
   at System.Net.ContextAwareResult.Complete(IntPtr userToken)
   at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr u
serToken)
   at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32
 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32
errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

Any assistance?

Most recent version of Unity.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TnServer crashing
« Reply #1 on: June 29, 2015, 07:30:44 AM »
I can't say I've ever seen that, but even if an error does occur in OnSend, the client will simply get disconnected and should never crash. Are you able to reproduce this easily? Make sure your TNet is up to date.

voncarp

  • Jr. Member
  • **
  • Thank You
  • -Given: 13
  • -Receive: 2
  • Posts: 91
    • View Profile
Re: TnServer crashing
« Reply #2 on: June 30, 2015, 04:07:43 PM »
I can't say I've ever seen that, but even if an error does occur in OnSend, the client will simply get disconnected and should never crash. Are you able to reproduce this easily? Make sure your TNet is up to date.

Its crashing daily.  The game is on Steam Early Access, so users are logging in every day and I keep having to restart TNserver.  I am on Unity 5.1.1f1.  Just updated TNet and NGUI and will report.

Let me know if you have thoughts on this.
« Last Edit: June 30, 2015, 04:16:07 PM by voncarp »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TnServer crashing
« Reply #3 on: July 02, 2015, 09:22:06 PM »
Where is your server hosted? What OS? I run mine on Windows for Windward and have never seen that. The message you're getting indicates that the queue is empty, but how can this be? It's in this block:
  1.                 lock (mOut)
  2.                 {
  3.                         // The buffer has been sent and can now be safely recycled
  4.                         Buffer b = (mOut.Count != 0) ? mOut.Dequeue() : null;
As you can see, the queue gets locked first, so nothing can modify it, then it's checked to see if there's something in it, and only then does the item get removed. In short, the only way this can possibly happen is if the "lock" is not working at all, and you get one thread checking if the count is not zero, pausing, another thread doing the same and dequeueing the item, then the first thread continues where it left off. The "lock" is supposed to prevent all that, and certainly does on Windows at least.

voncarp

  • Jr. Member
  • **
  • Thank You
  • -Given: 13
  • -Receive: 2
  • Posts: 91
    • View Profile
Re: TnServer crashing
« Reply #4 on: July 04, 2015, 03:42:58 PM »
Remote server.  Windows Server 2008.

I haven't updated Tnet in awhile.  I am uploading all my builds back onto Steam shortly.  Hopefully, those issues go away.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TnServer crashing
« Reply #5 on: July 06, 2015, 08:49:41 PM »
That would do it. TNet received a major bugfix update in May after Windward's release.