<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>232122</bug_id>
          
          <creation_ts>2021-10-21 17:43:54 -0700</creation_ts>
          <short_desc>REGRESSION (iOS 15): Canvas resizing causes webpage to jetsam</short_desc>
          <delta_ts>2022-01-10 18:35:02 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebGL</component>
          <version>Safari 15</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>231180</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter>akul</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>declan</cc>
    
    <cc>dino</cc>
    
    <cc>jonlee</cc>
    
    <cc>kbr</cc>
    
    <cc>kkinnunen</cc>
    
    <cc>kpiddington</cc>
    
    <cc>sabouhallawa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>smoley</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1807474</commentid>
    <comment_count>0</comment_count>
    <who name="">akul</who>
    <bug_when>2021-10-21 17:43:54 -0700</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1807736</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2021-10-22 10:10:17 -0700</bug_when>
    <thetext>I can reproduce with iOS 15.1 beta. This is a jetsam, i.e. running out of memory.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1807737</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-10-22 10:10:29 -0700</bug_when>
    <thetext>&lt;rdar://problem/84553912&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1807811</commentid>
    <comment_count>3</comment_count>
    <who name="Declan Johnson">declan</who>
    <bug_when>2021-10-22 11:59:52 -0700</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1820986</commentid>
    <comment_count>4</comment_count>
      <attachid>446159</attachid>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2021-12-07 04:34:16 -0800</bug_when>
    <thetext>Created attachment 446159
reduced testacy</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1820989</commentid>
    <comment_count>5</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2021-12-07 04:40:00 -0800</bug_when>
    <thetext>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&lt;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1820990</commentid>
    <comment_count>6</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2021-12-07 04:41:18 -0800</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1829673</commentid>
    <comment_count>7</comment_count>
    <who name="Jon Lee">jonlee</who>
    <bug_when>2022-01-10 16:30:07 -0800</bug_when>
    <thetext>Is this sample code a reduction of something that&apos;s out there in public? Is this the pattern being used by the Van Gogh art gallery, for example?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1829712</commentid>
    <comment_count>8</comment_count>
    <who name="Kenneth Russell">kbr</who>
    <bug_when>2022-01-10 18:35:02 -0800</bug_when>
    <thetext>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</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>446159</attachid>
            <date>2021-12-07 04:34:16 -0800</date>
            <delta_ts>2021-12-07 04:34:16 -0800</delta_ts>
            <desc>reduced testacy</desc>
            <filename>resize-crash.html</filename>
            <type>text/html</type>
            <size>1361</size>
            <attacher name="Kimmo Kinnunen">kkinnunen</attacher>
            
              <data encoding="base64">Y29uc3QgY29udGV4dEF0dHJpYnV0ZXMgPSB7CiAgYWxwaGE6IGZhbHNlLAogIGFudGlhbGlhczog
ZmFsc2UsCiAgZGVwdGg6IHRydWUsCiAgZmFpbElmTWFqb3JQZXJmb3JtYW5jZUNhdmVhdDogZmFs
c2UsCiAgcG93ZXJQcmVmZXJlbmNlOiAiZGVmYXVsdCIsCiAgcHJlbXVsdGlwbGllZEFscGhhOiB0
cnVlLAogIHByZXNlcnZlRHJhd2luZ0J1ZmZlcjogZmFsc2UsCiAgc3RlbmNpbDogdHJ1ZSwKICB4
ckNvbXBhdGlibGU6IHRydWUKfQoKZnVuY3Rpb24gcnVuVHJlZUpzRnJlZSgpIHsKICBjb25zdC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