Bug 217581 - The tab is crashed when WebGL canvas is resized
Summary: The tab is crashed when WebGL canvas is resized
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: ANGLE (show other bugs)
Version: Safari 14
Hardware: Mac macOS 10.15
: P2 Major
Assignee: Kimmo Kinnunen
URL:
Keywords: InRadar
Depends on: 217212
Blocks:
  Show dependency treegraph
 
Reported: 2020-10-11 11:34 PDT by reon90
Modified: 2021-08-30 06:32 PDT (History)
5 users (show)

See Also:


Attachments
Resize window -> memory was increased to 7GB -> tab crashed (12.93 MB, video/mp4)
2020-10-13 00:35 PDT, reon90
no flags Details
simpler repro (477 bytes, text/html)
2020-10-16 02:04 PDT, Kimmo Kinnunen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description reon90 2020-10-11 11:34:29 PDT
GPU: Intel UHD Graphics 630 1536 MB

* Open any canvas with webgl 1.0 or 2.0 e.g. https://reon90.github.io/redcube/
* Resize a browser window

Expected: Canvas is resized, the tab's memory is the same
Actual: Tab's memory is significantly increased to 5GB, after that the tab is crashed
Comment 1 Alexey Proskuryakov 2020-10-12 17:45:10 PDT
I cannot reproduce this with a Safari 14.0.1 beta.
Comment 2 reon90 2020-10-13 00:29:32 PDT
(In reply to Alexey Proskuryakov from comment #1)
> I cannot reproduce this with a Safari 14.0.1 beta.

It reproduces on Safari Beta and Latest Safari Developer Preview builds.
Comment 3 reon90 2020-10-13 00:35:57 PDT
Created attachment 411201 [details]
Resize window -> memory was increased to 7GB -> tab crashed
Comment 4 Kimmo Kinnunen 2020-10-13 03:45:13 PDT
Thanks for the report! I can repro this with my MacBookPro16,1 Intel/Radeon, Safari Technology Preview 114, macOS Big Sur
Does not repro with "Automatic graphics switching" off
Does repro with "Automatic graphics switching" on
Comment 5 Radar WebKit Bug Importer 2020-10-13 17:49:49 PDT
<rdar://problem/70273983>
Comment 6 Kimmo Kinnunen 2020-10-16 02:04:48 PDT
Created attachment 411550 [details]
simpler repro
Comment 7 Kimmo Kinnunen 2020-10-16 02:10:02 PDT
This problem seems to have existed before ANGLE switch, e.g. can be reproed on Safari 14.0 as well as 14.1 Technology Preview 114.
 
Appears that with integrated gpu we are not able to deallocate large iosurfaces fast enough.
Comment 8 Kimmo Kinnunen 2020-10-22 23:13:01 PDT
*** Bug 218100 has been marked as a duplicate of this bug. ***
Comment 9 Kenneth Russell 2020-10-23 18:26:47 PDT
While investigating Bug 218100, I found that the test case from that bug works after the fix from Bug 217212.

The test case from this bug works on a top-of-tree MiniBrowser Debug build. It consumes up to 6.3 GB of RAM, though that fluctuates down to ~3 GB sometimes.
Comment 10 reon90 2021-01-13 11:56:00 PST
Any chances to be fixed in near time?
Comment 11 Kenneth Russell 2021-01-13 12:43:29 PST
I think this was already implicitly fixed in Bug 217212. Kimmo, can you confirm?
Comment 12 reon90 2021-01-20 07:25:15 PST
I checked latest Safari Preview and there is the bug.
Comment 13 Kenneth Russell 2021-01-20 17:22:59 PST
I can confirm that in Safari Technology Preview Release 118 (Safari 14.1, WebKit 15611.1.9.3.1), the attached test case runs for about 30 seconds on my 2017 15" MacBook Pro before Safari reloads the tab because it was using significant memory.
Comment 14 Kimmo Kinnunen 2021-01-21 22:57:40 PST
Thanks for re-checking and the ping.
I’ve investigated this a bit but it’s unclear yet if it’s a “platform” issue or if something sane could be done at webkit level. I’ll try to see what I can come up with, but I don’t yet have a solution.