microsoft / MixedReality-HolographicRemoting-Samples

Code samples for using Microsoft's Holographic Remoting library.
Other
141 stars 47 forks source link

Holographic remoting desktop app in listen mode times out after 10 second and stops listening #86

Closed laultman closed 1 year ago

laultman commented 1 year ago

Build the solution and use the following command line in VS 2022 debug to initiate listen mode in the PC desktop remote app: 0.0.0.0 -listen. The PC app times out after 10 seconds.

Command line args: 0.0.0.0 -listen Launch the app in Visual Studio 2022 in debug PC-remote. When app starts and window appears, select the window to make it the active window and press the space bar as instructed to start the connection. After 10 seconds the window background turns blue and refuses additional attempts to connect. The app must be restarted to attempt additional connections.

Remote side (your Windows PC):

Player side (e.g. your HoloLens 2) Not applicable to the current issue.

laultman commented 1 year ago

I find by walking the code that when execution of the "ProcessEvents" function runs it is polling the XR_TYPE_EVENT_DATA_BUFFER. After 10 seconds with no connection established with the HoloLens 2, this XR_TYPE_REMOTING_EVENT_DATA_DISCONNECTED_MSFT is set. Fact is it never was connected. Once this state is found it starts it ends the current session. It required a human to press a key to initiate another session connection attempt. Two questions: 1 Where is this time interval check? 2 Why is it there, if maybe I want to run an open server.

Now that we know there a human input necessary to initiate a listen "session" and that this session appears to have a 10 second timer window, how is a good way to implement a robust server listener. And how can I reset the session from external code if there is no way from the existing design to listen and negotiate a session.

laultman commented 1 year ago

It appears that OpenXR does not have a concept of "remote" connections. It seems that the Microsoft Holographic Remoting extension is managing the TCP connection between the remote device and the host service. I cannot find any parameter or other setting to wait on a TCP connection. I cannot find a way to recycle while it waits on a connection for the 10 seconds that seems to be hard coded into the extension. That seems to be a rather ineffective way to design a "listener" service.

FlorianBagarMicrosoft commented 1 year ago

Hey @laultman, could you please try using the cmd line as follows: Command line args: -listen 0.0.0.0

The cmd line parser expects the IP to be at the end.

laultman commented 1 year ago

Hi @FlorianBagarMicrosoft thanks, I have no problem connecting in the listen mode. My problem is the 10 second time-out and it quits listening for connections. The listener waits for 10 seconds for a connection and then stops any further listening. That is not a server style listener. I need to know how to either change the listener to never time-out (server mode) or as a stop-gap, how to recycle to start listening again for the time-out period. I have been trying to workaround the time-out by recycling the process, but I can't get an event or status that the time-out has expired. Currently there is no way to know the status of it listener.

FlorianBagarMicrosoft commented 1 year ago

I just tested if our OpenXR remote app sample is working as expected, and you are correct, it's not. Expected behavior is that it stays on listening as long as there is no connection established or the remote app itself explicitly disconnects, say stops listening.

I have created a bug ticket internally and we will look into this as soon as possible.

laultman commented 1 year ago

Thank you! I think you will find the problem in the holographic extension. I created a simple app myself that uses the Microsoft.Holographic.AppRemoting nuget package v2.9.1. It too times-out in 10 seconds.

laultman commented 1 year ago

I hope you and the team can come up with a fix very quickly. I have been working on this issue for a couple months on the USMC project we have with DOD. I have masked the problem by manually connecting during demonstrations. Now it can't be pushed aside any longer. I believe that I have exhausted all possible options to make it work. I am using the StereoKit native C++ (SK) render engine built by members of the Mixed Reality Team. When the connection time-out occurs the StereoKit services terminates the app process - it immediately dies. This because its main entry point is SK.Run(). So when the app's main entry point, main() is called it initializes the SK engine and creates an instance of the remoting OpenXR with the Microsoft Holographic Remoting extension. After the SK is initialized it calls the SK.Run() method. Somehow the failure in the connect from the extension is causing the SK.Run() to terminate which in turn terminates the app by allowing the main() method to exit. The effect is simple, after 10 seconds the extension time-out occurs and the app terminates.

laultman commented 1 year ago

@FlorianBagarMicrosoft any movement on this yet?

FlorianBagarMicrosoft commented 1 year ago

@laultman, we have released Holographic Remoting version 2.9.2 which includes a fix for the listen issue when using OpenXR in your remote app.

laultman commented 1 year ago

Thank you, I received it early this morning. It does seem to fix the issue I had. I have some integration issues apart for the listening issue that I can now work on.

laultman commented 1 year ago

I will close this issue, thanks.