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

stacktrace_utils.dart 位置 getCurrentStackTrace 行 10 在 sentry #2268

Open
hao1208hao opened this issue Sep 4, 2024 · 6 comments
Open

Comments

@hao1208hao
Copy link

Platform

Flutter Mobile

Obfuscation

Enabled

Debug Info

Disabled

Doctor

[✓] Flutter (Channel stable, 3.22.2, on macOS 14.4
23E214 darwin-arm64, locale zh-Hans-CN)
• Flutter version 3.22.2 on channel stable at
/Users/pengsanyuan/Documents/flutter/flutter-sdk
• Upstream repository
https://github.com/flutter/flutter.git
• Framework revision 761747bfc5 (3 个月前), 2024-06-05
22:15:13 +0200
• Engine revision edd8546116
• Dart version 3.4.3
• DevTools version 2.34.3
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror
https://storage.flutter-io.cn

[!] Android toolchain - develop for Android devices
(Android SDK version 34.0.0)
• Android SDK at
/Users/pengsanyuan/Library/Android/sdk
✗ cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See
https://developer.android.com/studio/command-line
for more details.
✗ Android license status unknown.
Run flutter doctor --android-licenses to accept
the SDK licenses.
See
https://flutter.dev/docs/get-started/install/maco
s#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
• Xcode at
/Applications/Xcode.app/Contents/Developer
• Build 15F31d
• CocoaPods version 1.15.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google
Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3)
• Android Studio at /Applications/Android
Studio.app/Contents
• Flutter plugin can be installed from:
🔨
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
17.0.10+0-17.0.10b1087.21-11572160)

Version

8.7.0

Steps to Reproduce

I don't know

Expected Result

普通的异常信息收集

Actual Result

stacktrace_utils.dart 位置 getCurrentStackTrace 行 10 在 sentry

Hide 4 more frames
sentry_client.dart 位置 SentryClient._prepareEvent 行 270 在 sentry
sentry_client.dart 位置 SentryClient.captureEvent 行 117 在 sentry
sentry_client.dart 位置 SentryClient.captureMessage 行 335 在 sentry
hub.dart 位置 Hub.captureMessage 行 226 在 sentry

Are you willing to submit a PR?

None

@buenaflor
Copy link
Contributor

hi the message is misleading, it did not crash in stacktrace_utils.dart.

We attach stack frames from the Sentry Flutter SDK to check if there are crashes happening from it.

In your case it's just not correctly displaying that this is not a crash, we will take a look.

Also I suggest you to upgrade to Sentry Flutter 8.8.0 since 8.7.0 has been deprecated, see here

@buenaflor
Copy link
Contributor

I will investigate whether to just drop calling Stacktrace.current in the SDK which would fix this

@Fraa-124
Copy link

I'm seeing many issues with posts titled "getCurrentStackTrace" that lack information and are obfuscated. is this a bug? or am I doing something wrong?

@buenaflor
Copy link
Contributor

it's not a bug. When we parse error information sometimes the error we get from Flutter doesn't have a stacktrace, this is probably something Flutter/Dart specific and in those cases we try to capture a synthetic stacktrace with getCurrentStackTrace but most of the time that stacktrace is not helpful and misleading so we will probably remove this

@denrase
Copy link
Collaborator

denrase commented Oct 14, 2024

@buenaflor So i checked the current SDK behaviour. Took the call to OnErrorIntegration from our example app. We also call getCurrentStackTrace deeper in the SDK if we have an empty stack trace.

1.) Replaced with StackTrace.empty on the call side, so getCurrentStackTrace is called in the integration.

Image

2.) Set with StackTrace.empty in the integration.

Image

3.) Return StackTrace.empty from getCurrentStackTrace

Image

In this particular example, it seems to me that it makes sense to use the fallback, as we have more info the "closer" we are to the error. Will need to investigate others as well.

Also, the first two frames have package sentry and sentry_flutter, so it probably makes sense to filter them out (as opt-out), except for SDK crashes. WDYT?

@buenaflor
Copy link
Contributor

filter them out (as opt-out)

tbh I'm not sure how many people will actually read docs until they know this exists + I want to give users a good experience from the get-go without them having to adjust something in the options, especially something critical as stacktraces.

What if we just remove the sentry frames by default on StackTraces where we synthetically call them? Such as the integrations etc...

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

No branches or pull requests

5 participants