-
Notifications
You must be signed in to change notification settings - Fork 10
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
Firefox/Linux problems with "WebGL context was lost" #199
Comments
Thanks for reporting! I've actually been looking into this issue recently for a different reason: I find that it often affects me on Firefox/Android, resulting in a blank screen in our apps. Not great! I don't understand the issues too well, but I think that basically we need the web engine to notice "context lost" events and respond to them by re-acquiring it. As I understand it, if you do it right, there might be a hiccup in rendering but basically the app will be able to keep on working without requiring reloads or anything. At least, sometimes — I think this can also happen when When the context is lost, most WebGL routines become no-ops, but the CC @imbasimba, I know you're busy, but is this an aspect of WebGL that you've dealt with before? PS:* Also, thanks for the link, it's helpful to have a way to reproduce this on the desktop! I've only encountered the issue on my phone, where debugging is pretty hard. |
Well,I'm glad it's not just a problem with me ;-) |
WebGL context is a tricky issue. Ideally we never want to lose the WebGL context, but in reality a bunch of factors outside our control can cause the application to lose the WebGL context. For example, another process may steal the GPU for too long, or WWT and/or another process using too much of the GPU resources. When the context is lost, the entire WebGL state is lost (all variables and textures, shaders etc), so it is quite tricky to restore everything properly for a complex application like WWT. In theory, it is possible by using our JavaScript variables and context lost/restored events, but it would be an interesting challenge for sure. Currently, WWT is not even listening to these context lost/restored events, so a manual page reload is required. But if WWT is causing the loss of context, it would be better to track down the root cause instead. It could be something like a memory leak, a serious bug, or extremely inefficient rendering methods (like what we previously had for the circle annotations) A low effort way to semi-address this would be to add something along these lines: |
Can I, not WWT, add this event listener (I don't have time to learn all about webgl at the moment, unfortunately) as a work around? |
Here is a hacky way of doing it: If you want to manually trigger a context loss: |
Can I do this at any time, or is it worth waiting until I've called wwtlib.WWTControl.initControl or waited for the add_ready function to complete? |
You should be able do it any time after you've called initControl |
@imbasimba Thanks for the help! Let's talk about this more on our next call. On my phone (Android/Firefox), WWT doesn't work most of the time, and I've had other people report the same — it would be good to improve that situation. |
That is quite serious. Indeed the web client isnt even starting properly on my Android/Firefox, and the research app is starting but does not seem to be able to handle tab switches. I'll try to fit in some kind of investigation into this next week. |
This is based on the suggestion from WorldWideTelescope/wwt-webgl-engine#199 (comment)
I've implemented a workaround for my apps thanks to #199 (comment). Hopefully it won't interfere too badly with anything you fix on your end! |
@DougBurke If you get the chance to report back with how well it works for you, that would be super useful! Hopefully we can handle this more gracefully over time. |
It;s been implemented in both https://cxc.cfa.harvard.edu/csc2/wwt21.html so we'll get some feedback (as long as people are using them ;-), although I'm out for most of August so feed-back may be slow |
I have occasional issues with this. At best I can come up with is that this happens the first time I'm accessing the WWT, as I can reload the page and it goes away. My current firefox is 102.0.1 installed on ubuntu via a snap.
This is a new version of the CSC stress test (as it's in prep for the 2.1 release, so more polygons and even-more circles):
https://cxc.cfa.harvard.edu/csc2/wwt21.html
For the user the symptoms is that the page appears to load but either the stack polygons are not shown, or nothing from the WWT is shown. If I use the console log then at some point I see the message
and then at a later point it shows an error, such as
Unfortunately I don't think I (as the author) can catch or identify this problem, as it's coming from the WWT code (unfortunately I don't have an example of the problem to show file name/location info), so I don't know how I can let the user know they should try a reload (or if there's some other issue).
[I'm going to be away for a while, so I just wanted to note this in case it's a known problem or has an obvious solution]
The text was updated successfully, but these errors were encountered: