• choose theme
  • British Summer Time GMT+1

    Apple broke bento yesterday. A bug in Safari 18.0 was crashing the page instantly, with the inscrutable error message "a problem occurred repeatedly".

    It was difficult to debug, with no errors in the console, so the only option before me was to run it locally, commenting out chunks of code half by half by half until i could look it in the eyes.

    here's a reduced test case, an html file containing this:

    <script type="module">
    	let context = new AudioContext()
    	await context.audioWorklet.addModule(
    		"data:application/javascript,registerProcessor(%221%22%2C%20class%20extends%20AudioWorkletProcessor%7Bprocess()%7Breturn%20true%7D%7D)"
    	)
    	await context.audioWorklet.addModule(
    		"data:application/javascript,registerProcessor(%222%22%2C%20class%20extends%20AudioWorkletProcessor%7Bprocess()%7Breturn%20true%7D%7D)"
    	)
    	let sharedarraybuffer = new SharedArrayBuffer(906405)
    	new AudioWorkletNode(context, "1", {
    		processorOptions: {sharedarraybuffer},
    	})
    	new AudioWorkletNode(context, "2", {
    		processorOptions: {sharedarraybuffer},
    	})
    </script>

    In Safari 18.0 if you create a SharedArrayBuffer larger than 906404 bytes and then pass it to two separate audio worklets it crashes the page immediately. that's how bento works. The visuals and the sounds and the interactions are powered by a single chunk of memory that is shared between many workers (offscreen canvas worker and several audioworklets).

    because im the best who ever did it, i've pushed out a tmporary fix, by pulling all of the audio worklet code into one humongous monster that's sent only to Safari 18.0. It's unreadable, unmaintainable, but it only has to exist for a month. (a contact more daring than me confirms it's fixed in safari 18.1 likely to come out in october)