getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.88k stars 1.55k forks source link

WASM integration doesn't patch stack frames in WebKit #7223

Open Lms24 opened 1 year ago

Lms24 commented 1 year ago

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using? If you use the CDN bundles, please specify the exact bundle (e.g. bundle.tracing.min.js) in your SDK setup.

@sentry/browser

SDK Version

7.38.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

No response

Steps to Reproduce

cd packages/integration-tests
yarn test -g "wasm" --browser=webkit

Expected Result

The integration should patch the WebAssembly API so that when an error in a WASM module occurs, it can patch the module's stack frames:

Example:

{"addr_mode": "rel:0", "filename": "simple.wasm", "function": "internal_func", "in_app": true, "instruction_addr": "0x8c", "platform": "native"}

Actual Result

It seems like either patching the API doesn't work or patching the stack frames later on fails when using a WebKit-based browser.

Example of the actual stack frame from the expected example above:

{"abs_path": "[native code]", "filename": "[native code]", "function": "wasm-stub", "in_app": true}

Link to the failing test on CI: https://github.com/getsentry/sentry-javascript/actions/runs/4204160700/jobs/7294561872#step:11:341

Lms24 commented 1 year ago

Stack frames of the test error in chromium:

> {filename: <anonymous>, abs_path: <anonymous>, function: ?, in_app: true, lineno: 223}
> {filename: file:///Users/lukas/code/sentry-javascript/package…egration-tests/suites/wasm/dist/subject.bundle.js, abs_path: file:///Users/lukas/code/sentry-javascript/package…egration-tests/suites/wasm/dist/subject.bundle.js, function: window.getEvent, in_app: true, lineno: 16}
> {filename: https://localhost:5887/simple.wasm:wasm-function[1]:0x8c, abs_path: https://localhost:5887/simple.wasm:wasm-function[1]:0x8c, function: internal_func, in_app: true}
> {filename: file:///Users/lukas/code/sentry-javascript/package…egration-tests/suites/wasm/dist/subject.bundle.js, abs_path: file:///Users/lukas/code/sentry-javascript/package…egration-tests/suites/wasm/dist/subject.bundle.js, function: crash, in_app: true, lineno: 6}

stack frames of the same error in webkit:

> {filename: file:////Users/lukas/code/sentry-javascript/packag…egration-tests/suites/wasm/dist/subject.bundle.js, abs_path: file:////Users/lukas/code/sentry-javascript/packag…egration-tests/suites/wasm/dist/subject.bundle.js, function: ?, in_app: true, lineno: 16}
> {filename: [native code], abs_path: [native code], function: wasm-stub, in_app: true}
> {filename: file:////Users/lukas/code/sentry-javascript/packag…egration-tests/suites/wasm/dist/subject.bundle.js, abs_path: file:////Users/lukas/code/sentry-javascript/packag…egration-tests/suites/wasm/dist/subject.bundle.js, function: crash, in_app: true, lineno: 6}

They look quite different but among other things, we can see that the filename of the WASM module frame doesn't contain wasm-function and hence our stack frame patching isn't applied:

https://github.com/getsentry/sentry-javascript/blob/4ece78a4ca170a45198bba3a6d6c07c4f9942da0/packages/wasm/src/index.ts#L13

FredrikNoren commented 1 year ago

@Lms24 Any progress on this? Anything that can be done to help it along?

Lms24 commented 1 year ago

Hi @FredrikNoren, sorry, no progress on this. WASM is quite low on our list of priorities and we're completely packed with other tasks at the moment.

FredrikNoren commented 1 year ago

@Lms24 Any chance to bump the priority? We're building out a game development platform (https://ambient.run/) based on WASM and would be great to get crash reports on the web for us and for our users (it only works with wgpu, which only works with chrome, which means that sentry currently doesn't work for it). Also wasm based web frontends are becoming more and more popular (which we're also using, we're using https://dioxuslabs.com/). Happy to speak with any business leads about the future of wasm etc. if that helps :)

Lms24 commented 1 year ago

Hi, nothing changed here since my last reply. If you would like to see this happen, feel free to open a PR but at the moment we just don't have the resources (time) to look at this.