Skip to content

Commit abd1c38

Browse files
buenaflorgetsantry[bot]
authored andcommitted
SDKCD: ignore Flutter functions handleDrawFrame and handleBeginFrame (#89472)
SDKCD will falsely report `handleDrawFrame` and `handleBeginFrame` as SDK crashes although they are not. --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
1 parent 66617e6 commit abd1c38

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

src/sentry/utils/sdk_crashes/sdk_crash_detection_config.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,16 @@ def build_sdk_crash_detection_configs() -> Sequence[SDKCrashDetectionConfig]:
355355
},
356356
path_replacer=KeepFieldPathReplacer(fields={"package", "filename", "abs_path"}),
357357
),
358-
# getCurrentStackTrace is always part of the stacktrace when the SDK captures the stacktrace,
359-
# and would cause false positives. Therefore, we ignore it.
360358
sdk_crash_ignore_functions_matchers={
359+
# getCurrentStackTrace is always part of the stacktrace when the SDK captures the stacktrace,
360+
# and would cause false positives. Therefore, we ignore it.
361361
"getCurrentStackTrace",
362+
# Ignore handleDrawFrame and handleBeginFrame to avoid false positives.
363+
# In the Sentry Flutter SDK, we override the handleDrawFrame and handleBeginFrame methods,
364+
# add our custom implementation on top to instrument frame tracking and then forward the calls to Flutter.
365+
# However every custom implementation is try/catch guarded so no exception can be thrown.
366+
"SentryWidgetsBindingMixin.handleDrawFrame",
367+
"SentryWidgetsBindingMixin.handleBeginFrame",
362368
},
363369
)
364370
configs.append(dart_config)

tests/sentry/utils/sdk_crashes/test_sdk_crash_detection_dart.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,33 @@ def test_too_low_min_sdk_version_not_detected(
224224
)
225225

226226
assert mock_sdk_crash_reporter.report.call_count == 0
227+
228+
229+
@decorators
230+
def test_ignore_handle_begin_frame(mock_sdk_crash_reporter, mock_random, store_event, configs):
231+
event_data = get_crash_event(sdk_function="SentryWidgetsBindingMixin.handleBeginFrame")
232+
event = store_event(data=event_data)
233+
234+
configs[1].organization_allowlist = [event.project.organization_id]
235+
236+
sdk_crash_detection.detect_sdk_crash(
237+
event=event,
238+
configs=configs,
239+
)
240+
241+
assert mock_sdk_crash_reporter.report.call_count == 0
242+
243+
244+
@decorators
245+
def test_ignore_handle_draw_frame(mock_sdk_crash_reporter, mock_random, store_event, configs):
246+
event_data = get_crash_event(sdk_function="SentryWidgetsBindingMixin.handleDrawFrame")
247+
event = store_event(data=event_data)
248+
249+
configs[1].organization_allowlist = [event.project.organization_id]
250+
251+
sdk_crash_detection.detect_sdk_crash(
252+
event=event,
253+
configs=configs,
254+
)
255+
256+
assert mock_sdk_crash_reporter.report.call_count == 0

0 commit comments

Comments
 (0)