Azure / azure-spatial-anchors-samples

Azure Spatial Anchors sample code
Other
293 stars 137 forks source link

CreateSessionAsync() intermittently never returns #355

Open WikkidEdd opened 2 years ago

WikkidEdd commented 2 years ago

Description We've been experiencing issues in our app where occasionally the ASA setup flow would never return from SpatialAnchorManager.CreateSessionAsync(). We made an editable copy of the ASA Core package so we could add some extra logging in and we tracked the issue down to the call to Windows.Perception.Spatial.SpatialAnchorExporter.RequestAccessAsync(); which is called when validating the configuration. This function will await forever.

It appears to be some kind of race condition or timing-based issue as depending on what Unity version we use, it triggers at a slightly different frequency, going from 10% up to 50% of the time. Furthermore, we can't reproduce it in a standalone test app, only in our own app, but given how constrained the problem function is it's hard to conclude there is something specific in our app which is causing the problem.

As a workaround, we've commented out the spatial perception permission check and we no longer suffer the issue anymore.

We use ASA for synchronising multiple users in the same room, but because we're a distributed team we don't regularly get to test the feature so we can't say for sure when this issue started happening. Anecdotally, our users have reported more issues with ASA recently despite the app in the store not changing for 2 months. It's not conclusive, but it may indicate an OS update that causes this to happen more frequently.

Development information

AR Device information

XiangyuL-Microsoft commented 2 years ago

@WikkidEdd

Hi, Edd. May I have a few questions based on your information?

  1. About the "editable copy of the ASA Core package", how do you make the package editable and how do you edit it?
  2. Could you please share the "extra logging" which help you "tracked the issue down to the call to Windows.Perception.Spatial.SpatialAnchorExporter.RequestAccessAsync()"
  3. Is it possible for you to share the test app project with us for investigation purpose?

Thank you very much.

WikkidEdd commented 2 years ago
  1. We just copied the package from the Library/PackageCache folder into another directory and added it to the Unity package manager using the "Add package from disk..." option.
  2. We just added a Debug.Log line for every line inside CreateSessionAsync so we know which line it was called then it doesn't return. Then when it didn't return from EnsureValidConfiguration we added line for in every inside that and so on until we found it was Windows.Perception.Spatial.SpatialAnchorExporter.RequestAccessAsync() that never returns.
  3. Unfortunately, the test app doesn't trigger the issue only our app.
XiangyuL-Microsoft commented 2 years ago

@WikkidEdd Hi, Edd. As I mentioned in Issue 356. I spent several attempts to build and run the ASABug app on my HL2, unfortunately I never got a chance to reproduce it successfully.

XiangyuL-Microsoft commented 2 years ago

@WikkidEdd

We just released a new version of SDK 2.13.0. Could you try this new version of SDK to see if the problem still persists please? Thank you very much.

Varnauld commented 1 year ago

Hello @WikkidEdd - similarly for this issue, was the update in July helpful? If not, please let us know along with any additional details that may be helpful for us to investigate further, thank you