andrii1812 / galcon-server

Apache License 2.0
0 stars 0 forks source link

Strange Server Behavior #10

Closed yakivyusin closed 6 years ago

yakivyusin commented 6 years ago

Situation: 2 players connected to server and played the game.

Expected: Server continues work.

Now: Server closed and exe stopped after game finish.

andrii1812 commented 6 years ago

Is there some exceptions in the end that lead to exe closing?

yakivyusin commented 6 years ago

Important note: I finish the game by close one client (because it doesn't have ability to send fleets now). The second client receives End Game Message with reason 'enemy has left', before server closing.

Stack Trace:

> fail: Microsoft.AspNetCore.Server.Kestrel[13]
>       Connection id "0HL9H0KNIV77J": An unhandled exception was thrown by the application.
> System.NullReferenceException: Object reference not set to an instance of an object.
>    at GalconServer.App.TaskHandler.<Handle>d__7.MoveNext() in /home/travis/build/andrii1812/galcon-s
> erver/src/App/TaskHandler.cs:line 59
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
> 
>    at GalconServer.Core.ConnectionManager.<ReceiveLoop>d__15.MoveNext() in /home/travis/build/andrii
> 1812/galcon-server/src/Core/ConnectionManager.cs:line 91
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
> 
>    at GalconServer.Core.ConnectionManager.<Add>d__12.MoveNext() in /home/travis/build/andrii1812/gal
> con-server/src/Core/ConnectionManager.cs:line 57
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
> 
>    at GalconServer.Core.WebsocketAcceptMiddleware.<Invoke>d__5.MoveNext() in /home/travis/build/andr
> ii1812/galcon-server/src/Core/WebsocketAcceptMiddleware.cs:line 50
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
> 
>    at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3.MoveNext
> ()
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
> 
>    at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame`1.<RequestProcessingAsync>d__2.MoveNex
> t()
> info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
>       Request finished in 5829.8284ms 101
> dbug: Microsoft.AspNetCore.Server.Kestrel[10]
>       Connection id "0HL9H0KNIV77J" disconnecting.
> dbug: Microsoft.AspNetCore.Server.Kestrel[7]
>       Connection id "0HL9H0KNIV77J" sending FIN.
> dbug: Microsoft.AspNetCore.Server.Kestrel[8]
>       Connection id "0HL9H0KNIV77J" sent FIN with status "0".
> dbug: Microsoft.AspNetCore.Server.Kestrel[2]
>       Connection id "0HL9H0KNIV77J" stopped.
> fail: Microsoft.AspNetCore.Server.Kestrel[13]
>       Connection id "0HL9H0KNIV77I": An unhandled exception was thrown by the application.
> System.NullReferenceException: Object reference not set to an instance of an object.
>    at GalconServer.App.TaskHandler.<Handle>d__7.MoveNext() in /home/travis/build/andrii1812/galcon-s
> erver/src/App/TaskHandler.cs:line 59
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
> 
>    at GalconServer.Core.ConnectionManager.<ReceiveLoop>d__15.MoveNext() in /home/travis/build/andrii
> 1812/galcon-server/src/Core/ConnectionManager.cs:line 91
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
> 
>    at GalconServer.Core.ConnectionManager.<Add>d__12.MoveNext() in /home/travis/build/andrii1812/gal
> con-server/src/Core/ConnectionManager.cs:line 57
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
> 
>    at GalconServer.Core.WebsocketAcceptMiddleware.<Invoke>d__5.MoveNext() in /home/travis/build/andr
> ii1812/galcon-server/src/Core/WebsocketAcceptMiddleware.cs:line 50
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
> 
>    at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3.MoveNext
> ()
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
> 
>    at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame`1.<RequestProcessingAsync>d__2.MoveNex
> t()
> info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
>       Request finished in 30083.8731ms 101
> dbug: Microsoft.AspNetCore.Server.Kestrel[10]
>       Connection id "0HL9H0KNIV77I" disconnecting.
> dbug: Microsoft.AspNetCore.Server.Kestrel[7]
>       Connection id "0HL9H0KNIV77I" sending FIN.
> dbug: Microsoft.AspNetCore.Server.Kestrel[8]
>       Connection id "0HL9H0KNIV77I" sent FIN with status "0".
> dbug: Microsoft.AspNetCore.Server.Kestrel[2]
>       Connection id "0HL9H0KNIV77I" stopped.
> fail: GalconServer.Core.ConnectionManager[0]
>       Unknown exception occured while sending on socket
> System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connect
> ion without completing the close handshake. ---> System.ObjectDisposedException: Cannot access a dis
> posed object.
> Object name: 'FrameResponseStream'.
>    at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.FrameResponseStream.ValidateState(Cancellati
> onToken cancellationToken)
>    at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.FrameResponseStream.WriteAsync(Byte[] buffer
> , Int32 offset, Int32 count, CancellationToken cancellationToken)
>    at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.FrameDuplexStream.WriteAsync(Byte[] buffer,
> Int32 offset, Int32 count, CancellationToken cancellationToken)
>    at System.Net.WebSockets.ManagedWebSocket.SendFrameLockAcquiredNonCancelableAsync(MessageOpcode o
> pcode, Boolean endOfMessage, ArraySegment`1 payloadBuffer)
>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
> 
>    at GalconServer.Core.ConnectionManager.<Send>d__16.MoveNext() in /home/travis/build/andrii1812/ga
> lcon-server/src/Core/ConnectionManager.cs:line 103
> 
> Unhandled Exception: System.Net.WebSockets.WebSocketException: The remote party closed the WebSocket
>  connection without completing the close handshake. ---> System.ObjectDisposedException: Cannot acce
> ss a disposed object.
> Object name: 'FrameResponseStream'.
>    at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.FrameResponseStream.ValidateState(Cancellati
> onToken cancellationToken)
>    at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.FrameResponseStream.WriteAsync(Byte[] buffer
> , Int32 offset, Int32 count, CancellationToken cancellationToken)
>    at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.FrameDuplexStream.WriteAsync(Byte[] buffer,
> Int32 offset, Int32 count, CancellationToken cancellationToken)
>    at System.Net.WebSockets.ManagedWebSocket.SendFrameLockAcquiredNonCancelableAsync(MessageOpcode o
> pcode, Boolean endOfMessage, ArraySegment`1 payloadBuffer)
>    --- End of inner exception stack trace ---
>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
> 
>    at GalconServer.Core.ConnectionManager.<Send>d__16.MoveNext() in /home/travis/build/andrii1812/ga
> lcon-server/src/Core/ConnectionManager.cs:line 112
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
> 
>    at GalconServer.Core.ConnectionManager.<Broadcast>d__11.MoveNext() in /home/travis/build/andrii18
> 12/galcon-server/src/Core/ConnectionManager.cs:line 46
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
> 
>    at GalconServer.App.TaskHandler.<OnTickUpdated>d__5.MoveNext() in /home/travis/build/andrii1812/g
> alcon-server/src/App/TaskHandler.cs:line 45
> --- End of stack trace from previous location where exception was thrown ---
>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
>    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callb
> ack, Object state)
>    at System.Threading.ThreadPoolWorkQueue.Dispatch()
andrii1812 commented 6 years ago

Hope it will resolve an issue

yakivyusin commented 6 years ago

Fixed