<?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>181723</bug_id>
          
          <creation_ts>2018-01-17 03:07:50 -0800</creation_ts>
          <short_desc>REGRESSION (iOS 11.2.2): Unhandled Promise Rejection: Error: Out of executable memory in function at index</short_desc>
          <delta_ts>2020-01-15 17:38:56 -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>WebAssembly</component>
          <version>Safari 11</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>iOS 11</op_sys>
          <bug_status>REOPENED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>shader.yang</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>alonzakai</cc>
    
    <cc>annulen</cc>
    
    <cc>ap</cc>
    
    <cc>evan.exe</cc>
    
    <cc>fpizlo</cc>
    
    <cc>jfbastien</cc>
    
    <cc>jujjyl</cc>
    
    <cc>keith_miller</cc>
    
    <cc>m</cc>
    
    <cc>morten.sorvig</cc>
    
    <cc>saam</cc>
    
    <cc>walter</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1389950</commentid>
    <comment_count>0</comment_count>
    <who name="">shader.yang</who>
    <bug_when>2018-01-17 03:07:50 -0800</bug_when>
    <thetext>Steps:
1. open Safari on iOS 11.2.2/11.2.5 beta5
2. access link: https://www.mujigame.com/games/muji/ws22

Expected:
The page can be opened and wasm runs well.

Actual:
Get Unhandled Promise Rejection: Error: Out of executable memory in function at index exception.

More information:
This issue is also found on wkwebview on iOS 11.2.2/11.2.5 beta5

And the same discussion can be referred to:
https://forum.unity.com/threads/webassembly-no-longer-working-on-ios-11-2-2.511905/
https://github.com/kripken/emscripten/issues/6042</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1409499</commentid>
    <comment_count>1</comment_count>
    <who name="Keith Miller">keith_miller</who>
    <bug_when>2018-03-27 02:19:09 -0700</bug_when>
    <thetext>This issue is likely because we generate more code in our changes to mitigate Spectre and run out of executable memory. There isn&apos;t a quick solution to this on our end, unfortunately.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1410239</commentid>
    <comment_count>2</comment_count>
    <who name="">shader.yang</who>
    <bug_when>2018-03-29 06:12:21 -0700</bug_when>
    <thetext>(In reply to Keith Miller from comment #1)
&gt; This issue is likely because we generate more code in our changes to
&gt; mitigate Spectre and run out of executable memory. There isn&apos;t a quick
&gt; solution to this on our end, unfortunately.

Got it, thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1410244</commentid>
    <comment_count>3</comment_count>
    <who name="">shader.yang</who>
    <bug_when>2018-03-29 07:06:50 -0700</bug_when>
    <thetext>(In reply to Keith Miller from comment #1)
&gt; This issue is likely because we generate more code in our changes to
&gt; mitigate Spectre and run out of executable memory. There isn&apos;t a quick
&gt; solution to this on our end, unfortunately.

And more question, do you know whether this issue https://bugs.webkit.org/show_bug.cgi?id=183101 is related to Spectre patch too?

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1464339</commentid>
    <comment_count>4</comment_count>
    <who name="">morten.sorvig</who>
    <bug_when>2018-09-28 00:53:53 -0700</bug_when>
    <thetext>Would it be possible to increase the size of the executable memory pool for iOS devices?

The code in ExecutableAllocator.cpp suggests a current size of 64MB for ARM64:

#if defined(FIXED_EXECUTABLE_MEMORY_POOL_SIZE_IN_MB) &amp;&amp; FIXED_EXECUTABLE_MEMORY_POOL_SIZE_IN_MB &gt; 0
static const size_t fixedExecutableMemoryPoolSize = FIXED_EXECUTABLE_MEMORY_POOL_SIZE_IN_MB * 1024 * 1024;
#elif CPU(ARM)
static const size_t fixedExecutableMemoryPoolSize = 16 * 1024 * 1024;
#elif CPU(ARM64)
static const size_t fixedExecutableMemoryPoolSize = 64 * 1024 * 1024;
#elif CPU(X86_64)
static const size_t fixedExecutableMemoryPoolSize = 1024 * 1024 * 1024;
#else
static const size_t fixedExecutableMemoryPoolSize = 32 * 1024 * 1024;
#endif</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1464871</commentid>
    <comment_count>5</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2018-09-30 11:40:37 -0700</bug_when>
    <thetext>Is this still an issue in iOS 12?

The link reported here doesn&apos;t seem to do anything anymore.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1464959</commentid>
    <comment_count>6</comment_count>
    <who name="">morten.sorvig</who>
    <bug_when>2018-10-01 05:03:19 -0700</bug_when>
    <thetext>I can still reproduce this on 12.0 (16A366), using this test case: 

https://msorvig.github.io/qt-webassembly-examples/slate/slate.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1469115</commentid>
    <comment_count>7</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2018-10-14 21:04:33 -0700</bug_when>
    <thetext>We bumped the space to 128MB recently (in ToT WebKit). That will probably make this test case work. Marking as configuration changed for now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1471231</commentid>
    <comment_count>8</comment_count>
    <who name="Walter Stumpf">walter</who>
    <bug_when>2018-10-22 09:05:35 -0700</bug_when>
    <thetext>Looks like the change was reverted: https://bugs.webkit.org/show_bug.cgi?id=190453

If you need a new test case, I&apos;ve made one here: http://packages.kognito.com/Safari_iOS_WASM_Bug (this loads on Safari/Edge/Chrome/Firefox on the &quot;Desktop platform&quot; and Chrome/Firefox on the &quot;Android Platform&quot;).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1499101</commentid>
    <comment_count>9</comment_count>
    <who name="Walter Stumpf">walter</who>
    <bug_when>2019-01-28 11:22:59 -0800</bug_when>
    <thetext>Hello, iOS 12.2 has the configuration change this ticket references (https://bugs.webkit.org/show_bug.cgi?id=190453) that was hopefully going to resolve this issue, but unfortunately it still exists.  What are the next steps?  Can I provide you with any more information or test cases?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1499609</commentid>
    <comment_count>10</comment_count>
    <who name="Konstantin Tokarev">annulen</who>
    <bug_when>2019-01-29 11:10:08 -0800</bug_when>
    <thetext>Reopening because of report by Walter Stumpf above</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1499679</commentid>
    <comment_count>11</comment_count>
    <who name="Walter Stumpf">walter</who>
    <bug_when>2019-01-29 13:21:32 -0800</bug_when>
    <thetext>Okay apologies for not conducting a full review with iOS 12.2!  

So TLDR: I would rate this ticket as 99% resolved.  In some various use cases this exact error can still happen (e.g. loading our Unity wasm app, navigating to a new page, when navigating back to the original page our app will often trigger this error on second load).  But on a newly opened tab, our Unity app can consistently load.  I&apos;d still rate the behavior on 11.2.1 as more robust, but I think we can still work with the current implementation in 12.2.  

I apologize again for the confusion.  Thanks again for the help, you&apos;ve made every Unity webgl developer happy!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1504787</commentid>
    <comment_count>12</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2019-02-10 20:22:26 -0800</bug_when>
    <thetext>This probably won&apos;t be fully resolved until we implement an interpreter. But it might be worth looking into if we could try to GC to delete old code before throwing this exception.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1504790</commentid>
    <comment_count>13</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2019-02-10 20:23:44 -0800</bug_when>
    <thetext>&lt;rdar://problem/47954056&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1548540</commentid>
    <comment_count>14</comment_count>
    <who name="Michal Markowski">m</who>
    <bug_when>2019-06-27 11:09:07 -0700</bug_when>
    <thetext>It seems that the issue came back with the new iPadOS update. I checked few pages which worked on iOS 12 and they throw &quot;Error: Out of executable memory in function at index&quot; exceptionon on iPadOS 13 beta 2.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1560444</commentid>
    <comment_count>15</comment_count>
    <who name="Walter Stumpf">walter</who>
    <bug_when>2019-08-12 09:59:05 -0700</bug_when>
    <thetext>I can confirm on iPad OS (beta 6) this bug is back. :(  I have not tried iOS 13 on my iPhone yet, but on a fresh tab our wasm application (Unity game) cannot load on my iPad Pro.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1560810</commentid>
    <comment_count>16</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2019-08-13 09:17:21 -0700</bug_when>
    <thetext>Please file new bugs with repro steps for the regressions seen in iOS 13 beta. An old bug that isn&apos;t fully resolved shouldn&apos;t be conflated with cases that used to work, but no longer do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1560922</commentid>
    <comment_count>17</comment_count>
    <who name="Walter Stumpf">walter</who>
    <bug_when>2019-08-13 13:04:47 -0700</bug_when>
    <thetext>No worries I made one here: https://bugs.webkit.org/show_bug.cgi?id=200686</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1598916</commentid>
    <comment_count>18</comment_count>
    <who name="">jujjyl</who>
    <bug_when>2019-12-16 09:03:16 -0800</bug_when>
    <thetext>Running Unity content

http://clb.confined.space/dump/WebGL1-2019-12-11/

on Safari 12.1.1 on iPad Pro 2018 on iOS 12.3.1 works ok, but running the same page on Safari 13.0.3 on iPhone Xs on iOS 13.2.0 runs out of memory.

The communication trail at https://bugs.webkit.org/show_bug.cgi?id=200686 and https://bugs.webkit.org/show_bug.cgi?id=200807 suggests this bug would be fixed, though testing above page suggests that is not the case.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>