Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

System.Net.WebSockets.WebSocketException after OnClose is called #31

Open
JimiSmith opened this issue Mar 1, 2018 · 1 comment
Open

Comments

@JimiSmith
Copy link

I'm seeing a lot of WebSocketException being thrown after OnClose is called. Since it's after the connection has been closed it doesn't seem to be affecting the functionality of the service but it is filling up the logs quite a lot. Is there anyway to avoid this?

Stacktrace
System.Net.WebSockets.WebSocketException:
   at System.Web.WebSockets.WebSocketPipe+<>c__DisplayClass9_0.<ReadFragmentAsync>b__0 (System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Web.WebSockets.AspNetWebSocket+<DoWork>d__45`1.MoveNext (System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Web.WebSockets.AspNetWebSocket+<>c__DisplayClass36_0+<<ReceiveAsyncImpl>b__0>d.MoveNext (System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at Owin.WebSocket.Handlers.NetWebSocket+<ReceiveMessage>d__4.MoveNext (Owin.WebSocket, Version=1.7.0.0, Culture=neutral, PublicKeyToken=null)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at Owin.WebSocket.WebSocketConnection+<RunWebSocket>d__7.MoveNext (Owin.WebSocket, Version=1.7.0.0, Culture=neutral, PublicKeyToken=null)
@JimiSmith
Copy link
Author

I've done more investigation into this issue. The error code that is associated with the exception is 0x800703E3. However there is a type check that will fail in the various IsFatalSocketException methods. That method checks to make sure the type is a COMException. WebSocketException is not derived from COMException. This looks a fairly simple fix. Would you be open to a pull request that fixes this issue?

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

1 participant