Bug 232122 - REGRESSION (iOS 15): Canvas resizing causes webpage to jetsam
Summary: REGRESSION (iOS 15): Canvas resizing causes webpage to jetsam
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: Safari 15
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: anglemetalregr
  Show dependency treegraph
 
Reported: 2021-10-21 17:43 PDT by akul
Modified: 2022-01-10 18:35 PST (History)
10 users (show)

See Also:


Attachments
reduced testacy (1.33 KB, text/html)
2021-12-07 04:34 PST, Kimmo Kinnunen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description akul 2021-10-21 17:43:54 PDT
Repro app: https://jsfiddle.net/5an01w6d/

Works on ios14.3
Failed on ios 15

Repro steps: Click both buttons (which call their respective canvas resize methods). On ios14 this does not cause a page reload. On ios15 the webpage crashes and reloads with both. 

No logs from console were outputted.
Comment 1 Alexey Proskuryakov 2021-10-22 10:10:17 PDT
I can reproduce with iOS 15.1 beta. This is a jetsam, i.e. running out of memory.
Comment 2 Radar WebKit Bug Importer 2021-10-22 10:10:29 PDT
<rdar://problem/84553912>
Comment 3 Declan Johnson 2021-10-22 11:59:52 PDT
This bug is causing an experience ContinuumXR made for the Immersive Van Gogh Art Gallery in New York, Denver, and Las Vegas to no longer work. Users with ios 15 are no longer able to experience the pocket gallery exhibit.
Comment 4 Kimmo Kinnunen 2021-12-07 04:34:16 PST
Created attachment 446159 [details]
reduced testacy
Comment 5 Kimmo Kinnunen 2021-12-07 04:40:00 PST
So the test jetsams because depth or stencil buffers are being allocated and they consume too much memory.
The buffers are freed eventually, but not during the test resize iteration.
The logic is:
  for (int i=0;i<10000;++i)
    resize()

The buffers do not seem to leak permanently, temporarily.

Maybe the buffers are retained in the command buffer, and we are clearing too many buffers without waiting for the previous buffer clears to complete.
Comment 6 Kimmo Kinnunen 2021-12-07 04:41:18 PST
To workaround, the reporters can check if they need stencil and depth buffers for the default Framebuffer. If not, switching those off should work around this crash.
Comment 7 Jon Lee 2022-01-10 16:30:07 PST
Is this sample code a reduction of something that's out there in public? Is this the pattern being used by the Van Gogh art gallery, for example?
Comment 8 Kenneth Russell 2022-01-10 18:35:02 PST
Not sure whether the patch was intended for this bug, but this upstream patch to ANGLE seems to be addressing a similar concern:

Metal: Canvas resizing causes webpage to run out of memory
https://chromium-review.googlesource.com/c/angle/angle/+/3369922