StereoKit / StereoKit.HolographicRemoting

This is a NuGet package and tool that allows StereoKit to use the HoloLens' Holographic Remoting to run apps on your HoloLens from your PC.
https://stereokit.net
MIT License
10 stars 4 forks source link

StereoKit Run method times out after 10 seconds #13

Closed laultman closed 1 year ago

laultman commented 1 year ago

Whether I am in "normal" Player listens and remote connects or the other way around "Player" connects and remote listens, the SK remote app times out after 10 seconds of no connection. Here is what happens using the StereoKit Remoting solution out of the box. Build and run (HoloLens 2 is not on). PC remote app runs for 10 seconds and stops. (Notice the Platform diagnostic) This must be some type of fail-safe in StereoKit. The same behavior happens when the PC remote app is in listen mode. If there is no connection attempt within 10 seconds, the app terminates. Obviously, for a server listener app we want it to run continuously waiting on a connection.

[SK info] Session Performance Report: [SK info] __ [SK info] | System | Initialize | Update | Shutdown | [SK info] |____|____|__|_| [SK info] | Defaults | 38.31ms | | 0.07ms | [SK info] | FrameBegin | | 0.719ms | | [SK info] | Input | 1.14ms | 0.030ms | 0.69ms | [SK info] | Physics | 0.12ms | 0.883ms | 0.01ms | [SK info] | Renderer | 0.70ms | 0.001ms | 0.03ms | [SK info] | UI | 5.34ms | 0.029ms | 0.08ms | [SK info] | Platform | 10880.26ms | | 33.25ms | [SK info] | App | 14.21ms | 21808.617ms | | [SK info] | Animation | | 0.000ms | 0.00ms | [SK info] | Lines | 0.20ms | 0.000ms | 0.00ms | [SK info] | Sprites | 0.29ms | 0.000ms | 0.01ms | [SK info] | Text | | 0.002ms | 0.00ms | [SK info] | UILate | | 0.001ms | | [SK info] | World | 0.18ms | 0.000ms | 0.00ms | [SK info] | FrameRender | | 0.000ms | | [SK info] | Assets | 0.16ms | 0.000ms | 0.02ms | [SK info] | Audio | 245.59ms | 0.000ms | 41.37ms | [SK info] |____|____|__|_|

laultman commented 1 year ago

Update more information. I downloaded the Microsoft Holographic remoting samples to do more testing. The same behavior (10 second timeout) is also evident in the Microsoft sample code. In the case of the sample the timeout occurs 10 seconds after pressing the space bar to connect the app gives up on the connection. This seems to indicate that there is a lower level timeout running in the Microsoft extension. Any ideas how to overcome this to listen indefinitely?

laultman commented 1 year ago

More information. I have been tracing the Microsoft sample code to try and find the 10 second timer. It seems to be buried in the OpenXR or the Microsoft extension. The code is checking the status of the connection and after 10 seconds sets a disconnected state flag. I don't know where the 10 second timer is and I don't know how it is listening (protocol) for a connection attempt. My goal is to have a robust listener to establish a connection with a HoloLens 2 device that is calling the IP of the listener.

laultman commented 1 year ago

I have a confirmed bug in the MS OpenXR extension. Now I am trying to find a way around it until the bug gets fixed. The bug behavior is simple. On app start the extension listens for an incoming connection for 10 seconds. It is not blocking the app main thread during the 10 seconds. At the end of the 10 seconds the remote app has already called SK.Run() method. If no connection is made the app terminates. I have no idea why the app terminates. It almost seems that some unhandled exception has occurred but I can't seem to find it if it has. Is there any way to recycle the SK back to start up condition and re initialize? Or is there some way to determine from the SK side if a connection exists? I am just looking for a workaround until a real fix is ready. Naturally what should happen is the MS extension should simply wait for a connection as does a web server - could be forever.

laultman commented 1 year ago

Microsoft issued an update to the Microsoft Holographic Remoting package. The new version number is 2.9.2 and it does in fact fix the time out.