diarmidmackenzie / aframe-components

A selection of useful A-Frame Components
MIT License
28 stars 6 forks source link

`anchored` component hitting errors on Quest Pro #24

Open diarmidmackenzie opened 1 year ago

diarmidmackenzie commented 1 year ago

Apps that use persistent anchors using the anchored component seem to be able to get into a state where the WebXR session gets stuck with invalid anchor information, which triggers exceptions.

The initial symptoms are an exception like this:

Failed to execute 'restorePersistentAnchor' on 'XRSession': Anchor creation failed.

Further analysis of a case where this was happening showed that XR Session reporting 3 anchors in existence.

Didn't completely understand the issue, but it appeared that WebXR calls to either restore or delete the anchors were failing. Using various console commands, eventually managed to clear up the situation, not completely sure how, but possibly attempting (and failing) to restore the anchor, and then subsequently deleting it is what cleared things up.

handle-anchor-error branch contains some code to handle this failure mode (turning the exception into a warning) and attempt to clean up. Not sure how robust this is, and whether it might just end up masking problems (leading to things moving around when they should be anchored).

XR specs says the list of the known persistent anchors reported

MUST reflect the keys of the map of persistent anchors.

https://immersive-web.github.io/anchors/#dom-xrsession-deletepersistentanchor:~:text=persistentAnchors%20returns%20a%20list%20of%20the%20known%20persistent%20anchors.%20This%20list%20MUST%20reflect%20the%20keys%20of%20the%20map%20of%20persistent%20anchors.

And the specs only say the request to retore or delete an anchor will fail if the anchor ID is not valid, or the session has ended, neither of which seems to be the case.

So maybe a browser bug, but I've not clearly pinned this down yet.