microsoft / MixedRealityCompanionKit

This is a MixedRealityToolkit style repository for code bits and components that may not run directly on Microsoft HoloLens or immersive headsets but instead pair with them to build experiences.
MIT License
591 stars 286 forks source link

RealtimeStreaming Client crashes at the end of a connection (Invalid read size) #340

Open danilogr opened 5 years ago

danilogr commented 5 years ago

This happened while I was testing on Unity 2018.4.2f1 on Windows 1903 with the RealtimeStreaming compiled as Debug. Server (HoloLens) crashed and caused the client (Unity) to crash.

I attached VisualStudio to Unity and this is what the library prints on the console:

DataBundleArgsImpl::~DataBundleArgsImpl()
RealtimeMediaSource::OnDataReceived(0)
Connection::RunSocketLoop - Tid: 20584 
Connection::OnHeaderReceived() - Tid: 20584 
Connection::OnHeaderReceived() - Invalid read size 
Exception thrown at 0x00007FF88D8AA839 (KernelBase.dll) in Unity.exe: WinRT originate error - 0x800704B1 : 'The device is not currently connected but it is a remembered connection.'.
Exception thrown at 0x00007FF88D8AA839 in Unity.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x00000000005FC818.

This is the stack trace: image

To me, it seems that RealtimeStreaming throws an exception it could catch later. Often, TCP reads fail when the other party disconnected.

danilogr commented 5 years ago

Perhaps add a try-catch here? image