sentry-cocoa icon indicating copy to clipboard operation
sentry-cocoa copied to clipboard

fix: reportFullyDisplayed data race

Open philipphofmann opened this issue 1 year ago • 2 comments

:scroll: Description

Fix a data race when calling reportFullyDisplayed from a background thread by synchronizing the call to the main queue.

:bulb: Motivation and Context

This came up when enabling the thread sanitizer for the iOS-Swift sample app and navigating to the LoremIpsum screen.

CleanShot 2024-04-30 at 17 36 56@2x

:green_heart: How did you test it?

Unit tests and thread sanitizer in the iOS-Swift sample app.

:pencil: Checklist

You have to check all boxes before merging:

  • [x] I reviewed the submitted code.
  • [x] I added tests to verify the changes.
  • [x] No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • [x] I updated the docs if needed.
  • [x] Review from the native team if needed.
  • [x] No breaking change or entry added to the changelog.
  • [x] No breaking change for hybrid SDKs or communicated to hybrid SDKs.

:crystal_ball: Next steps

philipphofmann avatar Apr 30 '24 15:04 philipphofmann

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 90.802%. Comparing base (9537eaf) to head (f503ecc).

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #3926       +/-   ##
=============================================
- Coverage   90.846%   90.802%   -0.045%     
=============================================
  Files          593       592        -1     
  Lines        46028     45949       -79     
  Branches     16432     16363       -69     
=============================================
- Hits         41815     41723       -92     
- Misses        4034      4045       +11     
- Partials       179       181        +2     
Files Coverage Δ
Sources/Sentry/SentryTimeToDisplayTracker.m 100.000% <100.000%> (ø)
.../Sentry/SentryUIViewControllerPerformanceTracker.m 99.024% <100.000%> (+0.009%) :arrow_up:
...iewController/SentryTimeToDisplayTrackerTest.swift 100.000% <100.000%> (ø)
Tests/SentryTests/SentryHubTests.swift 98.850% <100.000%> (ø)

... and 19 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9537eaf...f503ecc. Read the comment docs.

codecov[bot] avatar Apr 30 '24 15:04 codecov[bot]

Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 1229.15 ms 1251.33 ms 22.18 ms
Size 21.58 KiB 617.00 KiB 595.42 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
f74904fa87218947c77c10540d685d25a43a1dd1 1229.02 ms 1244.91 ms 15.89 ms
591a01b3e320697e7cc86082284d786c359306e3 1242.69 ms 1259.98 ms 17.29 ms
60dd0f5656d961f9a9d604ceaf8dd5d99efd393d 1212.24 ms 1240.82 ms 28.58 ms
e1cd9e96643eb9563e7c09d6333b8ee67fca8798 1190.64 ms 1221.90 ms 31.26 ms
5f8ee7a3ef74bc6e32496015eb0cf13a539aedb8 1249.48 ms 1252.20 ms 2.72 ms
69d87595b411be6c93e72de62bc47457202fb72d 1229.88 ms 1240.45 ms 10.57 ms
e89dc54f3fd0c7ad010d9a6c7cb02ac178f3fc33 1207.86 ms 1218.27 ms 10.41 ms
f80109876fb5910e278957499d566bc708adffe1 1225.41 ms 1237.45 ms 12.04 ms
c0b4b714a9bc728c3452ce2627ea9b6c3275bb99 1218.16 ms 1251.28 ms 33.12 ms
bbcbaff4d524bd3af8e88f0f245b2e4256ffca3c 1216.82 ms 1242.34 ms 25.52 ms

App size

Revision Plain With Sentry Diff
f74904fa87218947c77c10540d685d25a43a1dd1 21.58 KiB 418.71 KiB 397.12 KiB
591a01b3e320697e7cc86082284d786c359306e3 22.84 KiB 401.67 KiB 378.83 KiB
60dd0f5656d961f9a9d604ceaf8dd5d99efd393d 20.76 KiB 393.37 KiB 372.61 KiB
e1cd9e96643eb9563e7c09d6333b8ee67fca8798 22.85 KiB 412.95 KiB 390.10 KiB
5f8ee7a3ef74bc6e32496015eb0cf13a539aedb8 22.85 KiB 411.93 KiB 389.08 KiB
69d87595b411be6c93e72de62bc47457202fb72d 20.76 KiB 393.05 KiB 372.29 KiB
e89dc54f3fd0c7ad010d9a6c7cb02ac178f3fc33 22.85 KiB 412.60 KiB 389.75 KiB
f80109876fb5910e278957499d566bc708adffe1 21.58 KiB 614.71 KiB 593.13 KiB
c0b4b714a9bc728c3452ce2627ea9b6c3275bb99 20.76 KiB 430.98 KiB 410.22 KiB
bbcbaff4d524bd3af8e88f0f245b2e4256ffca3c 22.85 KiB 414.09 KiB 391.24 KiB

github-actions[bot] avatar Apr 30 '24 16:04 github-actions[bot]