Closed maBarabas closed 2 months ago
hey, thanks for the issue, we'll have a look!
@maBarabas The issue is that you are awaiting finishing the transaction before runApp
is beeing called.
You have two options here:
Future<void> appMain() async {
runApp(MyApp());
final transaction = Sentry.startTransaction('hello', 'hello');
await transaction.finish();
}
Future<void> appMain() async {
final transaction = Sentry.startTransaction('hello', 'hello');
// .. do stuff
final endTime = DateTime.now();
runApp(MyApp());
await transaction.finish(endTimestamp: endTime);
}
In the case you mentioned one of our event processors ins running into a timeout, because the PostFrameCallback
is not being called when runApp
was not executed before.
Platform
Flutter Mobile
Obfuscation
Disabled
Debug Info
Disabled
Doctor
`flutter doctor -v`
``` [✓] Flutter (Channel stable, 3.22.3, on macOS 14.6 23G80 darwin-arm64, locale en-GB) • Flutter version 3.22.3 on channel stable at /Users/barabas/src/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision b0850beeb2 (4 weeks ago), 2024-07-16 21:43:41 -0700 • Engine revision 235db911ba • Dart version 3.4.4 • DevTools version 2.34.3 [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) • Android SDK at /Users/barabas/Library/Android/sdk • Platform android-35, build-tools 35.0.0 • ANDROID_HOME = /Users/barabas/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314) • All Android licenses accepted. [✓] 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 (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [✓] Android Studio (version 2024.1) • 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.11+0-17.0.11b1207.24-11852314) [✓] Connected device (4 available) • Pixel 5 (mobile) • 0C221FDD4003LH • android-arm64 • Android 13 (API 33) • iPhone XR (mobile) • 00008020-001E2C881A33002E • ios • iOS 16.5.1 20F75 • macOS (desktop) • macos • darwin-arm64 • macOS 14.6 23G80 darwin-arm64 • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 14.6 23G80 darwin-arm64 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 1 category. ```Version
8.7.0
Steps to Reproduce
Run this app on iOS or android in profile mode (using a real DSN):
Expected Result
App UI appears almost instantly after app is launched.
Actual Result
The UI appears after about 10s.
Rerun without the
tracesSamplerate
or without thedsn
or without thetransaction
or with Sentry before and notice that the UI appears in less than a second. Removing just one of these is enough to avoid the bug.I bisected on android and the first slow commit is https://github.com/getsentry/sentry-dart/commit/5e7abc5157b9e43973db9bc8e2a883d69d3fe136, where the app UI never appears.
Are you willing to submit a PR?
No