Closed Bug 1888645 Opened 2 months ago Closed 26 days ago

Message crash when displaying (wasm) stacktrace

Categories

(DevTools :: Console, defect, P3)

Firefox 125
defect

Tracking

(firefox127 fixed, firefox128 verified)

VERIFIED FIXED
128 Branch
Tracking Status
firefox127 --- fixed
firefox128 --- verified

People

(Reporter: bjornbaron, Assigned: nchevobbe)

References

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:125.0) Gecko/20100101 Firefox/125.0

Steps to reproduce:

  1. Visit https://bevyengine.org/examples-webgpu/2D%20Rendering/2d-gizmos/
  2. Open dev console
  3. Click on the arrow to the left of either of the error messages

Actual results:

[DEVTOOLS ERROR] We’re sorry, we couldn’t render the message. This shouldn’t have happened - please file a bug at https://bugzilla.mozilla.org/enter_bug.cgi?product=DevTools&component=Console with the message metadata in the description.

Clicking the "Copy message metadata to clipboard" button doesn't have any effect.

Expected results:

More details about the error message should be shown.

Thanks for the report, I can indeed reproduce the issue.

In the Browser Console, I'm getting the following error:

13:44:15.593 TypeError: can't access property "substring", id is null
    getFormattedSourceId resource://devtools/client/debugger/src/utils/source.js:239
    frames resource://devtools/client/shared/components/SmartTrace.js:262
    render resource://devtools/client/shared/components/SmartTrace.js:238
    React 13
    UNSAFE_componentWillMount resource://devtools/client/shared/components/SmartTrace.js:127
react-dom.js:12769:13

which comes from https://searchfox.org/mozilla-central/rev/511d9c9e2eb0f2291dc2b2a5462ba054dfc2edfe/devtools/client/debugger/src/utils/source.js#211-213

export function getFormattedSourceId(id) {
  return id.substring(id.lastIndexOf("/") + 1);
}

It should be easy to hotfix this, adding a guard when the id is null. We should also check why we're getting a null source id, and see if that's expected

Status: UNCONFIRMED → NEW
Ever confirmed: true
Severity: -- → S3
Priority: -- → P3
Summary: [DEVTOOLS ERROR] We’re sorry, we couldn’t render the message. → Message crash when displaying (wasm) stacktrace
Assignee: nobody → nchevobbe
Attachment #9393964 - Attachment description: WIP: Bug 1888645 - [devtools] Fix SmartTrace crash with wasm frames. → Bug 1888645 - [devtools] Fix SmartTrace crash with wasm frames. r=#devtools-reviewers.
Status: NEW → ASSIGNED
Duplicate of this bug: 1894720
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1fa5794fe422
[devtools] Fix SmartTrace crash with wasm frames. r=devtools-reviewers,bomsy.
Status: ASSIGNED → RESOLVED
Closed: 26 days ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch

In some cases, we were getting null sourceId, which was causing an exception
to be thrown in getFormattedSourceId since it expects a string.
We add a simple guard in this function so we don't throw anymore.

But we shouldn't get null sourceId in the first place. It looks like for
some Wasm sources, the SavedFrame sourceId can be 0, which wasn't playing
well with some loose check we were doing in the sources manager.

Finally, the "Copy metadata" button we display when a console message crash
wasn't working. The message now includes the targetFront, which can be serialized
in JSON, so we simply ignore it.

Original Revision: https://phabricator.services.mozilla.com/D206105

Attachment #9401586 - Flags: approval-mozilla-beta?

beta Uplift Approval Request

  • User impact if declined: in DevTools console, users won't be able to see the stacktrace of error messages emitted from wasm scripts
  • Code covered by automated testing: no
  • Fix verified in Nightly: no
  • Needs manual QE test: yes
  • Steps to reproduce for manual QE testing: see https://bugzilla.mozilla.org/show_bug.cgi?id=1888645#c0
  • Risk associated with taking this patch: low
  • Explanation of risk level: DevTools only, strengthening a couple checks and adding new guards
  • String changes made/needed: -
  • Is Android affected?: no
Flags: qe-verify+

Hello bjorn3, I was wondering if you were the developer behind https://bevyengine.org/ ?
The page was very helpful for me to fix the issue, but as I was trying to write a test for it, I couldn't manage to create a simple wasm project that would reproduce the issue and I was wondering if you could assist me for that.

Flags: needinfo?(bjornbaron)
QA Whiteboard: [qa-triaged]

I was able to reproduce the issue on Firefox 126.0a1 (2024-03-29) on macOS 14.5 by following the informations provided in Comment 0.

The issue is fixed on Firefox 128.0a1 (2024-05-15). Tests were performed on macOS 14.5 and Windows 11. It seems like Ubuntu 22/24 are loading the rendering and would not throw the errors in dev console.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-triaged]
Flags: qe-verify+
Attachment #9401586 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Hello bjorn3, I was wondering if you were the developer behind https://bevyengine.org/ ?

I am not.

The page was very helpful for me to fix the issue, but as I was trying to write a test for it, I couldn't manage to create a simple wasm project that would reproduce the issue and I was wondering if you could assist me for that.

Bevy uses wgpu for rendering. The page in question forces webgpu usage rather than using webgl. I can't test right now, but maybe https://wgpu.rs/examples reproduces the issue when forcing webgpu usage? If so that may be easier to reduce down to a test.

In any case, thanks for fixing this!

Flags: needinfo?(bjornbaron)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: