RESOLVED DUPLICATE of bug 261313 261331
REGRESSION (iPadOS 17 Developer Beta 8): "WebGL: context lost." error when backgrounding Safari
https://bugs.webkit.org/show_bug.cgi?id=261331
Summary REGRESSION (iPadOS 17 Developer Beta 8): "WebGL: context lost." error when ba...
Jason Hafer
Reported 2023-09-08 06:53:17 PDT
On iOS 17 Developer Beta 8 on tablets only (so iPadOS), we are seeing the error "WebGL: context lost." in the Web Inspector Console, after backgrounding Safari that is viewing a WebGL application. We are utilizing BabylonJS for a 3D rendering application. In some instances, backgrounding the Safari app, then making it active again in the foreground will cause the WebGL canvas to lose context, essentially crashing WebGL for any browser. Sometimes the crash just forces a full page refresh, and sometimes it hard-crashes with the console error, preventing the canvas element from rendering anything and becoming unresponsive. Once affected, any tab in Safari or Google Chrome will have unresponsive canvas elements. We have tested this with BabylonJS, ThreeJS, and minimal vanilla WebGL code, and each fail. To reproduce the issue, visit any one of the below in Safari: https://playground.babylonjs.com/ https://threejs.org/playground https://codepen.io/haferje/pen/QWzdavd With Web Inspector connected, as the page loads and before the WebGL instance has been initialized, quickly background Safari, then bring it back to the foreground. In the inspector Console, you will see the context lost error, and in Safari you will see that the webgl scene fails to create. For our applications, this also happens periodically when we background them even after WebGL is already initialized. A user on another forum responded to our post saying this happens when locking the device and unlocking again. This error was not present in beta 7. We are trying to understand why this is happening, so maybe it can be fixed before iOS 17 is released publicly, or we can create a work-around for the issue. Thank you.
Attachments
error breakpoint (309.43 KB, image/jpeg)
2023-09-25 02:15 PDT, Huabin LING
no flags
Radar WebKit Bug Importer
Comment 1 2023-09-08 08:26:39 PDT
Opher Vishnia
Comment 2 2023-09-11 04:40:25 PDT
We are experiencing the exact same regression issue at eko (where WebGL is used for video post-processing). To reproduce: Visit this URL in Safari: https://play.eko.com/page?id=FaGixErosH Minimize Safari or lock the phone with the power button. Then unlock the phone - WebGL has stopped, and will not work again on any page (eko or otherwise) with "WebGL: context lost". Video demo here: https://drive.google.com/file/d/17Kini4xI-eEg6fOYUpkMfonnIntCepYc/view?usp=sharing
Opher Vishnia
Comment 3 2023-09-11 04:46:16 PDT
Huabin LING
Comment 4 2023-09-25 02:00:42 PDT
We are seeing the same issue with Cocos Creator engine, including content in safari web page and content in WKWebView managed by WeChat. Testing environment: - iPhone 12 - iOS 16.7 (Lower version is ok) Testing with our local test case, but it's quite universal, we are testing public pages now
Huabin LING
Comment 5 2023-09-25 02:15:14 PDT
Created attachment 467845 [details] error breakpoint The error breakpoint inside WeChat WKWebView is in the screenshot, it indicates `b` from `gl.createShader` is null which is actually due to Context Lost. We double checked with `ctx.isContextLost()`, it returns true.
Huabin LING
Comment 6 2023-09-25 02:22:18 PDT
Actual behavior in iOS 16.7 Safari - Opened several webgl site and games, played a little while - Lock screen - Unlock screen (The following screen recording is after unlocking) https://drive.google.com/file/d/1HwSeWnSD0_MnuxrkMR_LoCI0Jgis5HIz/view?usp=sharing
Cheng Runfeng
Comment 7 2023-09-25 05:00:05 PDT
We also encountered this issue on Alipay, with iOS version 16.7 and above. A typical reproduction path is repeatedly entering and exiting a page that uses WebGL. The error message displayed is "WebGL: context lost" or "Error: WebGL unsupported in this browser".
Opher Vishnia
Comment 8 2023-09-25 11:14:42 PDT
In our case after much effort we've been able to narrow this down to a texImage2D call that receives a video element as its 6th argument. If the video is paused, then the WebGl crash happens (and WebGL will no longer be able to get context). If the video is playing, the crash does not happen. e.g. texImage2D( bindPoint, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, videoElement ); Our temporary workaround is to check whether the video was playing or not in iOS 17
Alexey Proskuryakov
Comment 9 2023-09-26 16:29:08 PDT
*** This bug has been marked as a duplicate of bug 261313 ***
Cheng Runfeng
Comment 10 2023-09-26 19:46:59 PDT
(In reply to Alexey Proskuryakov from comment #9) > > *** This bug has been marked as a duplicate of bug 261313 *** Will this fix be merged into later versions of iOS 16? We‘ve seen that the frequency of occurrence in iOS 16.7 is 20 times that of iOS 17.
Jason Hafer
Comment 11 2023-09-28 08:03:39 PDT
Do we know when this fix is going in? Is it going to be applied to 17.1? We are still seeing the same issue in the 17.1 Beta release.
Alexey Proskuryakov
Comment 12 2023-10-04 12:07:43 PDT
Please let us know if this still reproduces in iOS 17.1 Beta 2. > Will this fix be merged into later versions of iOS 16? We‘ve seen that the frequency of occurrence in iOS 16.7 is 20 times that of iOS 17. Let me bring this up for discussion.
Ocean
Comment 13 2023-10-08 03:41:43 PDT
We also encountered problems in iOS 16.7. If 17.1 can be fixed, whether there will be a fixed version in iOS 16. After all, there are still many users stuck on this version.
Note You need to log in before you can comment on or make changes to this bug.