hubs
hubs copied to clipboard
UI crashes when going back through Fast Room Swiching
Discussed in https://github.com/mozilla/hubs/discussions/5635
Originally posted by leonardoazzi August 4, 2022 Hello my beloved community,
Since I merged the HC August update, I'm facing a crash with fast room switching. In my instance (merged with hubs-cloud), when I go to a room through a portal (fast room switching) and then I try to go to another one, the UI crashes. I know the feature is still experimental, but I could't reproduce the issue in hubs.mozilla.com (master). It works just as it should. So, is there a fix to this issue not released to hubs-cloud yet?
Thanks :)
@leonardoazzi I was not able to reproduce the issue on the August update using Win 10 Chrome 104.0.5112.80. Can you please leave a link with room that has this issue? Also is this a custom client or just vanilla Hubs-Cloud?
I've definitely seen this problem on our Hubs Cloud and it is very likely to be a problem on Mozilla Hubs as well. You can usually reproduce it by making a sequence of three or more rooms that are linked, going to the end room and then pressing back a few times quickly.
The main cause is reentrancy in the changeHub
function, which we have addressed with a psudeo mutex. I'm not familiar enough with threading in Javascript to know if this is a robust solution.
I recommend that @Pattersonbl2 share a reliable reproduce on Mozilla Hubs. Without that I doubt a PR would be accepted even if I submitted one.
I've definitely seen this problem on our Hubs Cloud and it is very likely to be a problem on Mozilla Hubs as well. You can usually reproduce it by making a sequence of three or more rooms that are linked, going to the end room and then pressing back a few times quickly.
The main cause is reentrancy in the
changeHub
function, which we have addressed with a psudeo mutex. I'm not familiar enough with threading in Javascript to know if this is a robust solution.I recommend that @Pattersonbl2 share a reliable reproduction on Mozilla Hubs. Without that I doubt a PR would be accepted even if I submitted one.
This was a user-submitted issue from a GitHub discussion. if you could please add your reproduction steps and a pr for a possible fix that would be greatly appreciated. We had our QA team with the information given from the discussion test this but haven't been able to reproduce this issue.
@SV-AndreiC @Pattersonbl2 @rawnsley Thanks for your consideration. I've opened a discussion because I was in doubt if it was a known/duplicate issue or not. @Pattersonbl2 was very helpful and opened this issue for me, but certainly I should describe for you the steps to reproduce as soon as I can. I've seen this behavior after I merged the hubs-cloud august update with my custom code, both in localhost and in my deployed client. But I'll try to isolate the issue testing just with the hubs-cloud branch. Thanks again for your attention!
@Pattersonbl2 Sorry - I didn't read the small print closely enough!
You can reproduce the problem if you start from this room, follow the link to the next room, then follow the link back to the original room. Do this a few times taking care to let the room load completely, then press back two or three times in quick succession. This should trigger the bug.
If you click through the links before the room has completely loaded, I think another more subtle version of the bug is triggered in which the room appears to have changed, but the scene file has not.
Hello everyone,
I studied the issue and I actually introduced this behaviour in my custom code. I was trying to dispatch a "loading" message in change-hub.js , but in the wrong place and with the wrong type.
Now I've tested and created a proper type for this "hub-changing" state. I think it is useful, as a lot of users get lost when they click a portal and the fast room switch fades out of nothing. Also implemented @rawnsley solution to prevent crash (thanks!).
I started this conversation opening a discussion and writing in discord instead of opening an issue. I was not sure if it was a problem from the base code or from my custom code. However I think it an important discussion was opened with @rawnsley 's report and @Pattersonbl2 great support.
@Pattersonbl2 I think this specific issue could be closed now.
Thanks for your attention and dedication, as always!
Sounds like this issue is closed. Thanks everyone here for your insight and support!
Greetings and I hope everyone is well. I am still experiencing this issue.
Apologies if I missed a resolution.
Crash happens after trying to fast room switch more than once.
Thank you and I wish you the best with your projects, Damon