Closed Bug 1851468 Opened 1 year ago Closed 1 year ago

CompileError when using WASM exceptions in audio worklet

Categories

(Core :: JavaScript: WebAssembly, defect, P1)

Firefox 116
Desktop
All
defect

Tracking

()

VERIFIED FIXED
119 Branch
Tracking Status
relnote-firefox --- 117+
firefox-esr102 --- unaffected
firefox-esr115 --- unaffected
firefox117 + verified
firefox118 + verified
firefox119 + verified

People

(Reporter: gilles.piou, Assigned: rhunt)

References

(Regressed 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(2 files)

Steps to reproduce:

  1. Go on https://www.bandlab.com/
  2. In the console:
    (new AudioContext()).audioWorklet.addModule('https://www.bandlab.com/web-app/common/workers/libaudioengine-837fbc5d51.js')

Actual results:

CompileError: at offset 7983: exceptions not enabled

Expected results:

I expect the WASM module to be initialized without any error.

The error started to occur over the weekend, with many BandLab users reporting the same problem. I have switched back to a WASM module compiled without the support for exceptions for now.

I re-installed Firefox 116 on macOS, and it seems to work fine using that version. Is there any changes related to WASM and WASM exception in Firefox 117 that could cause this problem?

Attached image Error in console

Took the screenshot while using 118.0b4 (64-bit), but the error is reproducible on the stable channel.

The Bugbug bot thinks this bug should belong to the 'Core::JavaScript: WebAssembly' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → JavaScript: WebAssembly
Product: Firefox → Core

Maybe a regression from bug 1832378?

Wasm uses context options. I wonder if we're missing a call to xpc::SetPrefableContextOptions for worklets.

Flags: needinfo?(rhunt)

Yeah, I think the issue here is that Worklets don't read from Preferences to set ContextOptions and rely on the default field initializers (which changed slightly in bug 1832378). We also have testing for features that are enabled, but those don't run in worklets.

Simplest fix here is to get the default field initializers to be correct. However we really should have worklets reading from prefs too, otherwise we don't have the ability to unship proposals via pref if we need to.

Assignee: nobody → rhunt
Flags: needinfo?(rhunt)
Severity: -- → S1
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Keywords: regression
Priority: -- → P1
Regressed by: 1832378
Summary: CompileError when using WASM exceptions → CompileError when using WASM exceptions in audio worklet
Blocks: 1851854

Set release status flags based on info from the regressing bug 1832378

WorkletThread does not read from preferences to initialize JS::ContextOptions
and relies on the default values it has. This lead to a regression from
bug 1832378 where certain wasm features had their field's default change.
This didn't affect other globals because we read preferences from those
and so the default value is ignored.

This commit fixes the default value for wasm features in JS::ContextOptions
as a temporary fix, and adds a quick test in worklets.

Ideally worklets will read from preferences for consistency and to allow
us to force enable/disable features. But that's a bigger change.

Severity: S1 → S2
Priority: P1 → --
Priority: -- → P1

Mind filing a Worklet bug for the missing call to SetPrefableContextOptions? I think we should fix that soon before we accidentally ship something in worklets.

(In reply to Jan de Mooij [:jandem] from comment #7)

Mind filing a Worklet bug for the missing call to SetPrefableContextOptions? I think we should fix that soon before we accidentally ship something in worklets.

Bug 1851854 is filed. Looking at WorkletThread::EnsureCycleCollectedJSContext row of FIXME, there must be another similar bug.

Pushed by rhunt@eqrion.net: https://hg.mozilla.org/integration/autoland/rev/66edce3f7592 wasm: Set ContextOptions defaults to help consumers that don't read preferences. r=yury
Regressions: 1852104
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 119 Branch

Comment on attachment 9351853 [details]
Bug 1851468 - wasm: Set ContextOptions defaults to help consumers that don't read preferences. r?yury,#dom-workers-and-storage-reviewers

Beta/Release Uplift Approval Request

  • User impact if declined: Sites using Wasm exception-handling and in audio worklets will no longer work.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): This patch just changes the feature flag so that wasm exception-handling is enabled in worklets.
  • String changes made/needed:
  • Is Android affected?: Yes
Attachment #9351853 - Flags: approval-mozilla-release?
Attachment #9351853 - Flags: approval-mozilla-beta?

Comment on attachment 9351853 [details]
Bug 1851468 - wasm: Set ContextOptions defaults to help consumers that don't read preferences. r?yury,#dom-workers-and-storage-reviewers

Approved for 118.0b7, thanks.

Attachment #9351853 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Comment on attachment 9351853 [details]
Bug 1851468 - wasm: Set ContextOptions defaults to help consumers that don't read preferences. r?yury,#dom-workers-and-storage-reviewers

Approved for 117.0.1.

Attachment #9351853 - Flags: approval-mozilla-release? → approval-mozilla-release+
Flags: in-testsuite+

Added to the 117.0.1 release notes:

Fixed audio worklets not working for sites using WebAssembly exception handling

I have reproduced this issue on Windows 10 with Nightly v119.0a1 (2023-09-04) (64-bit) and verified the fix in Nightly v119.0a1 (2023-09-09) (64-bit), Beta v118.0b7 and Dot Release v117.0.1, On Windows 10, Ubuntu 22 and Mac OS 11. The compile error is no longer showing in the web console.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
OS: Unspecified → All
Hardware: Unspecified → Desktop

Thank you so much for the quick turnaround! BandLab Studio works fine with the latest version of Firefox ✅

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: