-
-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Cache binary images to be used for crashes #2939
Conversation
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
156e771 | 1228.06 ms | 1242.64 ms | 14.58 ms |
17afc4b | 1228.94 ms | 1251.10 ms | 22.16 ms |
e84bc3f | 1257.08 ms | 1267.41 ms | 10.33 ms |
ecd9ecd | 1215.77 ms | 1238.70 ms | 22.93 ms |
1bbcb9c | 1214.25 ms | 1230.04 ms | 15.79 ms |
efb2222 | 1258.22 ms | 1276.78 ms | 18.56 ms |
326b7eb | 1252.86 ms | 1259.56 ms | 6.70 ms |
c021422 | 1237.12 ms | 1263.18 ms | 26.06 ms |
455619d | 1231.40 ms | 1237.70 ms | 6.30 ms |
adcc7d8 | 1225.90 ms | 1245.08 ms | 19.18 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
156e771 | 20.76 KiB | 419.70 KiB | 398.94 KiB |
17afc4b | 20.76 KiB | 436.25 KiB | 415.49 KiB |
e84bc3f | 20.76 KiB | 434.72 KiB | 413.96 KiB |
ecd9ecd | 20.76 KiB | 420.23 KiB | 399.47 KiB |
1bbcb9c | 20.76 KiB | 426.10 KiB | 405.34 KiB |
efb2222 | 20.76 KiB | 424.45 KiB | 403.69 KiB |
326b7eb | 20.76 KiB | 432.31 KiB | 411.55 KiB |
c021422 | 20.76 KiB | 435.64 KiB | 414.88 KiB |
455619d | 20.76 KiB | 432.87 KiB | 412.11 KiB |
adcc7d8 | 20.76 KiB | 426.15 KiB | 405.39 KiB |
Previous results on branch: fix/writeBinaryImage
Startup times
Revision | Plain | With Sentry | Diff |
---|---|---|---|
9d73547 | 1262.36 ms | 1264.82 ms | 2.46 ms |
e6615d7 | 1232.69 ms | 1250.06 ms | 17.37 ms |
ba398d9 | 1242.84 ms | 1257.18 ms | 14.35 ms |
34bd45a | 1212.22 ms | 1228.80 ms | 16.58 ms |
c8aefaf | 1210.42 ms | 1241.44 ms | 31.02 ms |
d3dd6f3 | 1250.20 ms | 1265.80 ms | 15.59 ms |
488ea5e | 1221.65 ms | 1226.44 ms | 4.79 ms |
61c3a9a | 1234.14 ms | 1246.17 ms | 12.02 ms |
6035790 | 1234.37 ms | 1245.76 ms | 11.39 ms |
6dd069b | 1212.65 ms | 1222.88 ms | 10.23 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
9d73547 | 20.76 KiB | 435.51 KiB | 414.75 KiB |
e6615d7 | 20.76 KiB | 433.30 KiB | 412.54 KiB |
ba398d9 | 20.76 KiB | 435.52 KiB | 414.76 KiB |
34bd45a | 20.76 KiB | 435.54 KiB | 414.78 KiB |
c8aefaf | 20.76 KiB | 435.52 KiB | 414.76 KiB |
d3dd6f3 | 20.76 KiB | 435.58 KiB | 414.82 KiB |
488ea5e | 20.76 KiB | 433.76 KiB | 413.00 KiB |
61c3a9a | 20.76 KiB | 435.52 KiB | 414.76 KiB |
6035790 | 20.76 KiB | 435.85 KiB | 415.09 KiB |
6dd069b | 20.76 KiB | 435.58 KiB | 414.82 KiB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stoked that you're taking this on, nice work!
Co-authored-by: Andrew McKnight <andrew.mcknight@sentry.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should remove sentrycrashdl_imageCount
and sentrycrashdl_getBinaryImage
to ensure nobody is calling the async unsafe code anymore.
Thanks for tackling this, @brustolin. This is a tricky one.
Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
…coa into fix/writeBinaryImage
…coa into fix/writeBinaryImage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brustolin, I think the general approach looks fine, so I guess you can start adding tests now.
I think I found a few bugs in the code, so I wait until you add tests to give you a detailed review.
Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2939 +/- ##
=============================================
- Coverage 88.827% 88.799% -0.029%
=============================================
Files 493 495 +2
Lines 53141 53462 +321
Branches 19035 19141 +106
=============================================
+ Hits 47204 47474 +270
- Misses 4975 5028 +53
+ Partials 962 960 -2
... and 10 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, some small suggestions but no blockers as far as I can see. Nice work!
Tests/SentryTests/Integrations/SentryCrash/SentryCrashIntegrationTests.swift
Outdated
Show resolved
Hide resolved
Tests/SentryTests/Integrations/SentryCrash/SentryCrashIntegrationTests.swift
Outdated
Show resolved
Hide resolved
Co-authored-by: Andrew McKnight <andrew.mcknight@sentry.io>
…coa into fix/writeBinaryImage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brustolin, great job 🥇 ; I think we are close to merging this. Apart from my comments, here are a couple of things to address, please
- Add a changelog entry
- Remove
sentrycrashdl_imageCount
,sentrycrashdl_getBinaryImage
,SentryCrashDefaultBinaryImageProvider
- I'm a bit worried, that this could blow up for apps having loads of binary images and maybe use a weird setup. How can we minimize the risk of it blowing up?
Tests/SentryTests/Integrations/SentryCrash/SentryCrashIntegrationTests.swift
Show resolved
Hide resolved
I rather do this in another PR. There still code for non crash captures that uses |
I believe the amount of library loads that would cause a problem is too high to even be feasible in an App. |
I think releasing a beta, would be a good strategy. Furthermore, if it blows up, you should notice it immediately after starting the app. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost finished. We just need to adapt the tests a bit, and then LGTM.
Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
📜 Description
During crashes we use 2 async-signal-unsafe functions
_dyld_get_image_header
and_dyld_get_image_name
.This may lead to a crash report not being properly saved to disk.
This proposal will cache binary images during runtime and use it when the app crashes.
💡 Motivation and Context
Solves #1892
Maybe do #1096 in an extra PR.
💚 How did you test it?
📝 Checklist
You have to check all boxes before merging:
sendDefaultPII
is enabled.#skip-changelog