WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED CONFIGURATION CHANGED
206284
Old visited pages with wasm content are not cleared from memory when visiting a new wasm page, resulting in OOMs
https://bugs.webkit.org/show_bug.cgi?id=206284
Summary
Old visited pages with wasm content are not cleared from memory when visiting...
jujjyl
Reported
2020-01-15 03:20:33 PST
It looks like Safari's page history navigation stack retains old WebAssembly compiled pages in memory, and is unable to release them on demand on memory pressure when visiting a new page with wasm content, but instead Safari OOMs due to running out of executable memory to compile WebAssembly. (this is only a hypothesis, alternative is that the old Wasm compiled pages genuinely memory leak Wasm code memory?) STR: 1. Visit
https://connect.unity.com/p/kart-mobile-1-0-6?loadingMobile=1
2. Click on Play. 3. Click OK when seeing the dialog that mobile is not yet supported in Unity. 4. When seeing the [Name Your Game] dialog, reload the page and go to step 2. After some 2-3 reloads, the page is unable to load, but fails in WebAssembly compilation stage with error message [Error] failed to asynchronously prepare wasm: Error: Out of executable memory in function at index 13067 o (commons.631d1802c56e56ea3106.bundle.js:1:368842) printErr (UnityLoader.js:4:11151) (anonymous function) (blob:
https://connect.unity3dusercontent.com/698c33ac-6d65-4875-89b4-ec8bdfddc8b4:8:31284
) promiseReactionJob It has observed that smaller WebAssembly modules enable more refreshes until hitting this OOM. E.g. this page
https://connect.unity.com/p/kart-template-oz?loadingMobile=1
contains the same content as in the STR link URL in step 1, but optimized for size rather than speed, and that OOMs as well, but needs more page refreshes for it to happen. Tested to reproduce on iPhone 11 Pro Max on iOS 13.3.
Attachments
Add attachment
proposed patch, testcase, etc.
jujjyl
Comment 1
2020-01-15 03:31:59 PST
For reference, the size of the .wasm file in
https://connect.unity.com/p/kart-mobile-1-0-6?loadingMobile=1
is 21,478,291 bytes, whereas the size of the .wasm file in
https://connect.unity.com/p/kart-template-oz?loadingMobile=1
is 5,305,089 bytes.
jujjyl
Comment 2
2020-01-15 04:33:49 PST
Ops, posted wrong size for the kart-template-oz figure (that was the gzipped size on disk). The correct size for .wasm module in
https://connect.unity.com/p/kart-template-oz?loadingMobile=1
is 18,140,743 bytes. So 3,337,548 bytes smaller uncompressed compared to wasm module in kart-mobile-1-0-6 url.
Radar WebKit Bug Importer
Comment 3
2020-01-15 22:18:46 PST
<
rdar://problem/58634092
>
Keith Miller
Comment 4
2020-03-17 15:04:34 PDT
Hi there, thanks for the report! I think what was happening was that the Unity wasm module was using a very large amount of memory just to launch and the GC couldn't collect the old module's JIT memory fast enough during a reload. This appears to have been fixed by the new Wasm interpreter. Also, the game seems to launch dramatically faster (<1-2s vs 30+sec).
jujjyl
Comment 5
2020-04-15 22:38:21 PDT
Hey, this is great! Any info on which iOS/Safari version would first have the fix? I'd love to verify that the issue no longer reproes. In addition to the above links failing, it has been reported that
https://tiny.vision/demos/TinyRacing/Wasm/TinyRacing.html
would also fail to run. That page is an order of magnitude smaller compared to the Kart mobile web page in
comment 0
.
Keith Miller
Comment 6
2020-04-15 22:45:04 PDT
The fix should have shipped with Safari 13.1 in MacOS 10.15.4 and iOS 13.4.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug