-
-
Notifications
You must be signed in to change notification settings - Fork 278
Description
Platform
Flutter Mobile Android
Obfuscation
Disabled
Debug Info
Disabled
Doctor
[✓] Flutter (Channel stable, 3.35.7, on macOS 26.1 25B78 darwin-arm64, locale en-US)
• Flutter version 3.35.7 on channel stable
• Dart version 3.9.2
• DevTools version 2.48.0
[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0)
• Platform android-36.1, build-tools 36.1.0
• Java version OpenJDK Runtime Environment (build 21.0.8+-14196175-b1038.72)
Version
9.8.0
Steps to Reproduce
- Deploy Flutter app with
sentry_flutter: ^9.8.0on low-memory Android devices (3-4GB RAM) - Enable performance monitoring with default settings:
await SentryFlutter.init((options) { options.tracesSampleRate = 1.0; options.profilesSampleRate = 1.0; // enableFramesTracking defaults to true });
- Run app on affected devices:
- Samsung Galaxy Tab A7 (Android 12, 3GB RAM, MediaTek MT8768T)
- itel S686LN (Android 15, 3-4GB RAM, UNISOC processor) - Use app normally under memory pressure (multiple apps running, background processes)
- Crash occurs unpredictably during Flutter message loop processing
Key factors:
- Only reproduces on low-end Android devices (3-4GB RAM)
- Requires memory pressure (aggressive GC cycles)
- Android 12-15 affected
- Does not occur on high-end devices or other platforms
Expected Result
Sentry's frame tracking should safely invoke Window.onReportTimings callbacks without crashing, even under memory pressure on low-end Android devices.
Frame tracking metrics should be collected reliably, or the integration should gracefully handle callback lifecycle issues (e.g., check callback validity before invocation).
Actual Result
App crashes with SIGSEGV (Segmentation Fault) when Sentry's background thread attempts to invoke a stale Window.onReportTimings callback.
Stack Trace (Issue HEDY-AI-AZQ):
Thread: SentryExecutorServiceThreadFactory-0
flutter::Shell::ReportTimings::lambda::operator() (shell.cc:1633)
→ flutter::Engine::ReportTimings (engine.cc:301)
→ flutter::RuntimeController::ReportTimings (runtime_controller.cc:312)
→ flutter::PlatformConfiguration::ReportTimings (platform_configuration.cc:469)
→ tonic::DartInvoke (dart_invoke.cc:24)
→ Dart_InvokeClosure (dart_api_impl.cc:4710)
→ dart::DartEntry::InvokeFunction (dart_entry.cc:167)
→ globalEnv_CallObjectMethod () ← SIGSEGV HERE
Error Details:
- Signal:
SIGSEGV: Segfault - Thread:
SentryExecutorServiceThreadFactory-0(Sentry's background thread) - Mechanism:
signalhandler - Handled:
no(fatal crash)
Impact:
- Production app crashes (16 users affected, 16 occurrences)
- Only on low-memory Android devices
- Started appearing in version with
sentry_flutter 9.8.0
Root Cause Analysis:
Sentry's frame tracking registers a Dart callback with Flutter's Window.onReportTimings. On low-memory devices with aggressive GC:
- Sentry's background thread (
SentryExecutorServiceThreadFactory-0) attempts to invoke the callback - Under memory pressure, the Dart callback reference becomes stale/invalid
- JNI call (
globalEnv_CallObjectMethod) attempts to access freed memory - SIGSEGV crash occurs
Workaround:
Disable frame tracking on Android:
if (Platform.isAndroid) {
options.enableFramesTracking = false;
options.enableAutoPerformanceTracing = false;
}
This workaround eliminates the crash while preserving all error/crash reporting functionality.
### Are you willing to submit a PR?
NoneMetadata
Metadata
Assignees
Projects
Status