MagicOnion icon indicating copy to clipboard operation
MagicOnion copied to clipboard

Unhandleable exceptions when connecting

Open AdamFrisby opened this issue 2 years ago • 1 comments

StreamingHubClientBase.cs has multiple locations where it traps exceptions, and by default, silently eats them; preventing them being handled appropriately.

StartSubscribe() (line circa 139 and circa 161) can receive RpcExceptions and other faults when a connection fails; however due to it silently eating these at this point, it becomes impossible to know whether a connection is alive or dead; particularly in the case of a unidirectional StreamingHub where the client only receives messages from the server.

This is compounded by NullLogger being the default, which eats the log messages informing of the fault, leading to an undetectable state where a connection has failed, but no errors are reported.

AdamFrisby avatar Oct 30 '23 23:10 AdamFrisby

Whether a StreamingHub connection has been established can be determined by whether ConnectAsync throws an exception. If the connection is disconnected while receiving a message, you can handle it by waiting for WaitForDisconnect.

When an exception thrown by await moveNext (in StartSubscribe) are caught, the subscription is stopped and signalled to WaitForDisconnect.

We are considering passing the cause of the error to WaitForDisconnect. Would that be insufficient?

mayuki avatar Jan 11 '24 08:01 mayuki

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Jul 10 '24 00:07 github-actions[bot]