Skip to content
This repository has been archived by the owner on Oct 18, 2018. It is now read-only.

Unexpected end of stream - Should be close? #63

Closed
benaadams opened this issue Dec 5, 2015 · 8 comments
Closed

Unexpected end of stream - Should be close? #63

benaadams opened this issue Dec 5, 2015 · 8 comments
Milestone

Comments

@benaadams
Copy link

fail: AgeOfAscent.Space.SpaceWebSocketsMiddleware[1]
      PlayerWebsocket error System.AggregateException: One or more errors occurred. ---> System.IO.IOException: Unexpected end of stream
         at Microsoft.AspNet.WebSockets.Protocol.CommonWebSocket.<EnsureDataAvailableOrReadAsync>d__38.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at Microsoft.AspNet.WebSockets.Protocol.CommonWebSocket.<ReadNextFrameAsync>d__37.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at Microsoft.AspNet.WebSockets.Protocol.CommonWebSocket.<ReceiveAsync>d__36.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at AgeOfAscent.Web.Network.PlayerWebsocket.<CompleteReceiveTaskAsync>d__57.MoveNext() in I:\IllyriadGames.AgeOfAscent\src\AgeOfAscent.Space\Network\PlayerWebsocket.cs:line 311
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at AgeOfAscent.Web.Network.PlayerWebsocket.<ReceiveProcessAsync>d__54.MoveNext() in I:\IllyriadGames.AgeOfAscent\src\AgeOfAscent.Space\Network\PlayerWebsocket.cs:line 276
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at AgeOfAscent.Web.Network.PlayerWebsocket.<ReceiveAsync>d__53.MoveNext() in I:\IllyriadGames.AgeOfAscent\src\AgeOfAscent.Space\Network\PlayerWebsocket.cs:line 266
         --- End of inner exception stack trace ---
      ---> (Inner Exception #0) System.IO.IOException: Unexpected end of stream
         at Microsoft.AspNet.WebSockets.Protocol.CommonWebSocket.<EnsureDataAvailableOrReadAsync>d__38.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at Microsoft.AspNet.WebSockets.Protocol.CommonWebSocket.<ReadNextFrameAsync>d__37.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at Microsoft.AspNet.WebSockets.Protocol.CommonWebSocket.<ReceiveAsync>d__36.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at AgeOfAscent.Web.Network.PlayerWebsocket.<CompleteReceiveTaskAsync>d__57.MoveNext() in I:\IllyriadGames.AgeOfAscent\src\AgeOfAscent.Space\Network\PlayerWebsocket.cs:line 311
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at AgeOfAscent.Web.Network.PlayerWebsocket.<ReceiveProcessAsync>d__54.MoveNext() in I:\IllyriadGames.AgeOfAscent\src\AgeOfAscent.Space\Network\PlayerWebsocket.cs:line 276
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at AgeOfAscent.Web.Network.PlayerWebsocket.<ReceiveAsync>d__53.MoveNext() in I:\IllyriadGames.AgeOfAscent\src\AgeOfAscent.Space\Network\PlayerWebsocket.cs:line 266<---
@Tratcher
Copy link
Member

Tratcher commented Dec 7, 2015

How did you hit this?

@benaadams
Copy link
Author

I think hard disconnects/dirty close rather than close messages; can recreate easily by connecting via websockets with a client then terminating it (the client)

@benaadams
Copy link
Author

It didn't do anything untoward - other than being very messy for the error log

@benaadams
Copy link
Author

@Tratcher
Copy link
Member

Tratcher commented Dec 7, 2015

Oh so it's behaving as expected, it's just noisy. A disconnect is an error in the WebSocket protocol, it's just not a very interesting one. We can check the flow and see if it can be simplified.

@benaadams
Copy link
Author

Yea, agreed, but its a bit like someone disconnecting mid http download - probably don't care too much; whereas a fail is like a "go investigate what's wrong" type thing. Could be a debug, verbose or even just "disconnected" info type report?

@muratg
Copy link

muratg commented Jan 12, 2016

Moving out, though would be happy to accept a PR :)

@ergen
Copy link

ergen commented Dec 17, 2016

I get the same error. I read most of the links but I could not understand how to handle it. I publish my application and send data to the client. it works. then I disconnect the client without closing browser (like unplugging network cable) and try sending again it fails. I use try catch and looks ok but then I get this error in log file. should I detect the users who are not used to close their browsers and block them from the application.. I add this link here because of GitHub does not let vote down

@muratg muratg closed this as completed Apr 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants