Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JTokenMessageParser.Parse exception may cause unhandled exception and crash process #175

Open
bigbearzhu opened this issue Mar 2, 2017 · 3 comments

Comments

@bigbearzhu
Copy link
Contributor

This is the stack trace. The JTokenMessageParser.Parse does capture exception and log it, and, rethrow it. However, the callers to the function don't capture the exception and handle it. So it would end up as unhandled and crash the process. Would you think WebSocket4NetTextConnection.OnMessageReceived should capture exception and swallow it? Same thing happens on WebSocket4NetBinaryConnection.OnDataReceived. Thanks.

   at WampSharp.Newtonsoft.JTokenMessageParser.Parse(String text)
   at WampSharp.WebSocket4Net.WebSocket4NetTextConnection`1.OnMessageReceived(Object sender, MessageReceivedEventArgs e)
   at WebSocket4Net.WebSocket.OnDataReceived(Byte[] data, Int32 offset, Int32 length)
   at SuperSocket.ClientEngine.AsyncTcpSession.ProcessReceive(SocketAsyncEventArgs e)
   at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
   at System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
@darkl
Copy link
Member

darkl commented Mar 2, 2017

Actually all connections need to terminate upon a serialization error (and a few other errors).

For now we should mimic the JSON/text behavior. I'll try to make serialization exceptions terminate the connection in a future release.

Elad

@bigbearzhu
Copy link
Contributor Author

bigbearzhu commented Mar 2, 2017 via email

@darkl
Copy link
Member

darkl commented Mar 2, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants