Bug 256023 - Out of memory error of generating WebAssembly.Memory in AudioWorklet Processor after reloading many times
Summary: Out of memory error of generating WebAssembly.Memory in AudioWorklet Processo...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebAssembly (show other bugs)
Version: Safari 16
Hardware: iPhone / iPad iOS 16
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-04-26 19:51 PDT by tamaru
Modified: 2024-06-18 01:09 PDT (History)
8 users (show)

See Also:


Attachments
Source code of the demo page (1.99 KB, application/x-zip-compressed)
2023-04-26 19:51 PDT, tamaru
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description tamaru 2023-04-26 19:51:11 PDT
Created attachment 466113 [details]
Source  code of the demo page

Steps to produce:
1. Create a web page:
1.1. Create an AudioContext and an AudioWorklet.
1.2. Create a 256MB (to be precise, 268435456 bytes) WebAssembly.Memory in the AudioWorkletProcessor.
2. Open the page in iOS Safari or iOS Chrome.
3. Reload the page many (7) times.
-> On the 7th reload (8th opening), the WebAssembly.Memory cannot be created due to an "Out of memory" error.

Notes:
- Opening the page in another tab does not cause the issue.
- Just referring to the buffer of the WebAssembly.Memory also prevents the issue, but I do not know why.
- Closing the AudioContext and assigning null to the WebAssembly.Memory did not solve the issue.

Demo page:
https://wasm-memory-in-audioworklet-test.netlify.app/
By selecting "OK" of the confirmation dialog, the buffer of the WebAssembly.Memory will be referred to, resulting in no error.
By selecting "Cancel" of the confirmation dialog, the buffer of the WebAssembly.Memory will not be referred to, resulting in the error on the 7th reload.

The source code is attached.

I tested on iPadOS 16.4.1, iPad Air 5th gen.
Comment 1 Radar WebKit Bug Importer 2023-05-03 19:52:20 PDT
<rdar://problem/108873396>
Comment 2 goldwaving 2023-12-18 07:43:58 PST
Just a few reloads of our audio editing app (https://goldwave.com/editor) fails on Safari version 17.2 with a memory range error, but Firefox and Chrome work fine (on non-iOS devices).  The error continues for every reload until Safari is terminated.
Comment 3 Ivan Čurić 2024-01-31 04:50:22 PST
Seems related to: https://bugs.webkit.org/show_bug.cgi?id=222097
Comment 4 Alex Suzuki 2024-06-18 01:09:14 PDT
This is the same issue as https://bugs.webkit.org/show_bug.cgi?id=222097 and should be marked as duplicate.

This bug is causing problems in production for customers of our barcode scanning library STRICH (https://strich.io). It is especially annoying as reloading the page will not fix the issue, and this is definitely not something users are accustomed to.