[Webkit-unassigned] [Bug 224279] OfflineAudioContext startRendering fail after N calls

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 7 13:07:33 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=224279

--- Comment #10 from Chris Dumez <cdumez at apple.com> ---
(In reply to Chris Dumez from comment #6)
> (In reply to Jason from comment #5)
> > I have further narrowed down the issue to just the instantiation of the
> > OfflineAudioContext.  Number of instantiations until you receive the error
> > is based on the length param.  The larger the length, the sooner you will
> > encounter the issue.  With length 4000 * 44100, iOS 14.4.2 starts throwing
> > errors on the 2nd instantiation.  Desktop safari (Version 14.0.3
> > (16610.4.3.1.7)) will show the same errors as iOS "The string did not match
> > the expected pattern" after ~20 iterations, then crash or reload the page.
> > 
> > https://codepen.io/jasonmcaffee/pen/wvgrqLb
> > 
> > ```
> > const AudioContext = window.AudioContext || window.webkitAudioContext;
> > const OfflineAudioContext = window.OfflineAudioContext ||
> > window.webkitOfflineAudioContext;
> > 
> > //demonstrate that iOS starts crashing or erroring when performing offline
> > renders more than N times.
> > async function main(){
> >   const sampleRate = 44100;
> >   const length = 4000 * sampleRate;
> >   for(let i = 0; i < 60; ++i){
> >     print(`rendering ${i}`);
> >     try{
> >       new OfflineAudioContext(2, length, sampleRate);
> >     }catch(e){
> >       print(`error rendering offline: `, e.message);
> >     }
> >   }
> >   print(`done`);
> > }
> > 
> > const outputEl = document.querySelector('#output');
> > function print<T extends unknown>(...params: T[]){
> >   const message = params.map(p => JSON.stringify(p).replace(/['"]+/g,
> > '')).join(` `);
> >   outputEl.innerHTML += `${message}<br/>`;
> > }
> > 
> > main();
> > ```
> 
> Thanks, this is very helpful.

Note that even if I fix the leak, this test case will still fail. The reason is that you are never yielding so JS garbage collection does not get a change to run. A better test case would use setTimeout() to make sure GC has a chance to destroy the audio contexts.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210407/e4a157ad/attachment-0001.htm>


More information about the webkit-unassigned mailing list