Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Flutter Web WASM symbolication #1480

Open
marandaneto opened this issue May 25, 2023 · 8 comments
Open

Support Flutter Web WASM symbolication #1480

marandaneto opened this issue May 25, 2023 · 8 comments

Comments

@marandaneto
Copy link
Contributor

marandaneto commented May 25, 2023

Description

JS package -> https://github.com/getsentry/sentry-javascript/tree/develop/packages/wasm
The SDK needs to fill the debug_meta property with the image list.
Flutter Web probably exposes the WebAssembly.Module as well, if not, we can leverage that by using the JS SDK directly.
The Dart plugin should upload the DWARF files.

SDKs cannot depend on html packages nor its transitive dependencies
https://docs.flutter.dev/platform-integration/web/wasm#requires-preview-js-interop-to-access-browser-and-js-apis

Sentry Flutter SDK isn't compatible as of now.
Sentry Dart SDK compiles just fine.

Blocked by flutter/flutter#127564 as well

Update by @buenaflor:

We are going to utilise sourcemaps generated like so flutter web --wasm --source-maps

However the current generated sourcemaps by dart2wasm don't contain function names.

Currently blocked by: dart-lang/sdk#56718

This dart2wasm issue is now done and fully supports sourcemaps generation starting from dart 3.7.0-41.0.dev

@marandaneto
Copy link
Contributor Author

Dart SDK compiles but it does not work either.
We have to guard every call that depends on dart.library.html or dart.library.io to a no-op call. we do this most of the time but there are probably a few exceptions not considered because we always assume it's either one or the other.

Screenshot 2023-05-25 at 10 41 52

@marandaneto marandaneto moved this from Needs Discussion to Blocked in Mobile & Cross Platform SDK May 25, 2023
@vaind
Copy link
Collaborator

vaind commented Jun 20, 2024

runtime parsing can also be improved, currently (dart2wasm used in tests and introduced in #2113) we get this:

{
  event_id: dd5764b21ef04faa84c5c9c4a4e54447,
  timestamp: 2024-06-20T17: 43: 53.646Z,
  platform: other,
  user: {
    ip_address: {
      {
        auto
      }
    }
  },
  sdk: {
    name: sentry.dart.browser,
    version: 8.3.0,
    packages: [
      {
        name: pub: sentry,
        version: 8.3.0
      }
    ]
  },
  exception: {
    values: [
      {
        type: _Exception,
        value: Exception,
        stacktrace: {
          frames: [
            {
              filename: unparsed,
              function: at_rootRunUnarytear-offtrampoline(http: //localhost: 60835/MHrTmoJ7AVBxEfI0R9zMcjvHD1kUs8gC/test/sentry_client_test.dart.browser_test.dart.wasm: wasm-function[
                6756
              ]: 0xd9fef),
              abs_path: http: //localhost: 60835/unparsed,
              in_app: true
            },
            {
              filename: unparsed,
              function: at_rootRunUnary(http: //localhost: 60835/MHrTmoJ7AVBxEfI0R9zMcjvHD1kUs8gC/test/sentry_client_test.dart.browser_test.dart.wasm: wasm-function[
                2929
              ]: 0x86136),
              abs_path: http: //localhost: 60835/unparsed,
              in_app: true
            },
            {
              filename: unparsed,
              function: atclosurewrapperatfile: ///Users/ivan/dev/tools/flutter/bin/cache/dart-sdk/lib/_internal/wasm/lib/async_patch.dart: 83: 16trampoline(http: //localhost: 60835/MHrTmoJ7AVBxEfI0R9zMcjvHD1kUs8gC/test/sentry_client_test.dart.browser_test.dart.wasm: wasm-function[
                5634
              ]: 0xc3c13),
              abs_path: http: //localhost: 60835/unparsed,
              in_app: true
            },
            {
              filename: unparsed,
              function: at_awaitHelperclosureatfile: ///Users/ivan/dev/tools/flutter/bin/cache/dart-sdk/lib/_internal/wasm/lib/async_patch.dart: 83: 16(http: //localhost: 60835/MHrTmoJ7AVBxEfI0R9zMcjvHD1kUs8gC/test/sentry_client_test.dart.browser_test.dart.wasm: wasm-function[
                5628
              ]: 0xc3b39),
              abs_path: http: //localhost: 60835/unparsed,
              in_app: true
            },
            {
              filename: unparsed,
              function: atDeclarer.testclosureatfile: ///Users/ivan/.pub-cache/hosted/pub.dev/test_api-0.7.2/lib/src/backend/declarer.dart: 213: 22inner(http: //localhost: 60835/MHrTmoJ7AVBxEfI0R9zMcjvHD1kUs8gC/test/sentry_client_test.dart.browser_test.dart.wasm: wasm-function[
                6573
              ]: 0xd758e),
              abs_path: http: //localhost: 60835/unparsed,
              in_app: true
            },
            {
              filename: unparsed,
              function: atclosurewrapperatfile: ///Users/ivan/dev/sentry-dart/dart/test/sentry_client_test.dart: 121: 7trampoline(http: //localhost: 60835/MHrTmoJ7AVBxEfI0R9zMcjvHD1kUs8gC/test/sentry_client_test.dart.browser_test.dart.wasm: wasm-function[
                1146
              ]: 0x5bdf9),
              abs_path: http: //localhost: 60835/unparsed,
              in_app: true
            },
            {
              filename: unparsed,
              function: atmainclosureatfile: ///Users/ivan/dev/sentry-dart/dart/test/sentry_client_test.dart: 121: 7(http: //localhost: 60835/MHrTmoJ7AVBxEfI0R9zMcjvHD1kUs8gC/test/sentry_client_test.dart.browser_test.dart.wasm: wasm-function[
                942
              ]: 0x58b01),
              abs_path: http: //localhost: 60835/unparsed,
              in_app: true
            }
          ]
        }
      }
    ]
  }
}

@buenaflor
Copy link
Contributor

buenaflor commented Sep 18, 2024

flutter web wasm won't generate DWARF since it disables some binaryen optimizations, instead they utilize sourcemaps

we can generate source maps on flutter wasm with the --source-maps flag but function names are not added.

once this issue lands this flutter web wasm symbolication for us will be unblocked

@vaind vaind removed their assignment Oct 3, 2024
@buenaflor
Copy link
Contributor

fyi the stack_trace package was updated to support parsing WASM frames, see https://pub.dev/packages/stack_trace/changelog

it requires dart 3.4 so it's unusable for us but we can get take a look in how they parse them

@vaind
Copy link
Collaborator

vaind commented Oct 11, 2024

fyi the stack_trace package was updated to support parsing WASM frames, see https://pub.dev/packages/stack_trace/changelog

it requires dart 3.4 so it's unusable for us but we can get take a look in how they parse them

the bump to 3.4 seems arbitrary...

here's the PR for future reference. https://github.com/dart-lang/stack_trace/pull/159/files#diff-ed67bb474f51f23727dc5890aa26e248d4190e14f574b2e46cf631864d38354e

@buenaflor
Copy link
Contributor

This dart2wasm issue is now done and fully supports sourcemaps generation starting from dart 3.7.0-41.0.dev

@buenaflor buenaflor moved this from Blocked to Backlog in Mobile & Cross Platform SDK Oct 19, 2024
@smeubank
Copy link
Member

@buenaflor does that mean the issue can be closed, or it is just unblocked?

@buenaflor
Copy link
Contributor

@smeubank it's unblocked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

5 participants