-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoiding race conditions in parallel exclusive session requests #343
Comments
I suggest we reject new exclusive mode session requests while there are any outstanding. Since exclusive mode requests involve user consent UI, reducing the number of interleaving prompts is desired. Edge currently takes this approach for WebVR. |
Rafael's solution sounds totally reasonable to me. |
Third'ing Rafael's solution, and seems to work nice with attempting multiple potential session configurations outside of exclusivity when probing for overlaps between supported feature sets by device and the application: async onStart() {
const device = await navigator.xr.requestDevice();
const featureSets = [{ exclusive: true, featureA: true }, { exclusive: true, featureB: true }];
let session;
while (!session && featureSets.length) {
try {
session = await device.requestSession(featureSets.shift());
} catch (e) {}
}
} It seems to be dangerous from an application logic perspective to allow multiple in-flight exclusive requests, although interested in learning more about why a request would take "too long" (10 seconds?) in order to queue up another request. Is that something that can happen? |
FWIW I believe that Rafael's solution was what was agreed to on the previous WebXR call as well. I'll put up a pull request soon to document it. |
@toji Does this PR close this issue? |
Currently the spec does not define how race conditions between multiple exclusive session requests should be handled.
https://immersive-web.github.io/webxr/#dom-xrdevice-requestsession
For example: If Request A starts and is held up in stage 7, then Request B starts while A is outstanding, what should the behavior of B be?
Proposal:
The text was updated successfully, but these errors were encountered: