getsentry / sentry-dart

Sentry SDK for Dart and Flutter
https://sentry.io/for/flutter/
MIT License
761 stars 239 forks source link

TTID and TTFD are not measured, due to timing issues #2274

Closed givip closed 1 month ago

givip commented 2 months ago

Platform

Flutter Mobile

Obfuscation

Disabled

Debug Info

Enabled

Doctor

[✓] Flutter (Channel stable, 3.24.1, on macOS 14.3 23D56 darwin-arm64, locale en-GB) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.4) [✓] Chrome - develop for the web [✓] Android Studio (version 2024.1) [✓] VS Code (version 1.92.2) [✓] Connected device (4 available)
[✓] Network resources

Version

8.8.0

Steps to Reproduce

Sometimes, due to timing issues, the transaction is not registered and consequently not sent to Sentry.

Videos, where repro captured:

Couple initial navigation events registered, but last one not. On screencast, you can see, that there is no message in console. https://github.com/user-attachments/assets/e8b84e11-7ecb-4dea-8215-9130078469cf https://github.com/user-attachments/assets/9888c394-f59e-4bf5-9e6f-1fc98d382e36

Minimal code, where I was able to reproduce the issue: https://github.com/givip/sentry_repro

This happens because sometimes method completeTracking() was called earlier than trackRegularRouteTTD()

Expected Result

All transactions should be registered

Actual Result

Sometimes, the transaction is not registered and consequently not sent to Sentry.

Are you willing to submit a PR?

No

buenaflor commented 2 months ago

hey! thanks for raising this, we'll have a look

buenaflor commented 2 months ago

Could you reproduce the same without using SentryDisplayWidget?

buenaflor commented 2 months ago

but yes I was able to reproduce it using SentryDisplayWidget:

I/flutter (10200): stop ttid tracking
I/flutter (10200): start ttid tracking

For now I'd suggest not using SentryDisplayWidget until we've fixed this problem

denrase commented 2 months ago

@givip Can you also reproduce it if you provide Sentry with the appRunner?

void main() async {
  await SentryFlutter.init(
    (options) {
        ...
    },
    appRunner: () => runApp(
        SentryDisplayWidget(
          child: const MyApp(),
        )
    ),
  );
}