ref: move startOption storage to SentrySDKInternal - #8054
Merged
Conversation
Move the `_startOption` state and its lock from `SentrySDK.swift` into `SentrySDKInternal.m`, making `SentrySDK.startOption` and `setStart(with:)` thin passthroughs. All internal callers now use `SentrySDKInternal.options` directly.
philprime
requested review from
NinjaLikesCheez,
itaybre,
noahsmartin and
philipphofmann
as code owners
June 12, 2026 12:52
philprime
enabled auto-merge (squash)
June 12, 2026 12:54
5 tasks
philprime
marked this pull request as draft
June 12, 2026 12:57
auto-merge was automatically disabled
June 12, 2026 12:57
Pull request was converted to draft
📲 Install BuildsiOS
|
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| d1ddc41 | 1236.42 ms | 1267.21 ms | 30.79 ms |
| 78aad96 | 1232.02 ms | 1262.42 ms | 30.40 ms |
| 8bb6aeb | 1232.15 ms | 1260.78 ms | 28.63 ms |
| bc68ff6 | 1227.02 ms | 1254.89 ms | 27.87 ms |
| 4082d65 | 1225.47 ms | 1252.28 ms | 26.81 ms |
| e0946cf | 1233.33 ms | 1258.57 ms | 25.24 ms |
| 1155f0c | 1222.41 ms | 1251.18 ms | 28.76 ms |
| 8180609 | 1214.67 ms | 1243.36 ms | 28.69 ms |
| 151b3ee | 1238.69 ms | 1270.73 ms | 32.05 ms |
| ae8cece | 1216.83 ms | 1251.37 ms | 34.55 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| d1ddc41 | 24.14 KiB | 1.17 MiB | 1.15 MiB |
| 78aad96 | 24.14 KiB | 1.18 MiB | 1.16 MiB |
| 8bb6aeb | 24.14 KiB | 1.17 MiB | 1.15 MiB |
| bc68ff6 | 24.14 KiB | 1.16 MiB | 1.14 MiB |
| 4082d65 | 24.14 KiB | 1.19 MiB | 1.17 MiB |
| e0946cf | 24.14 KiB | 1.16 MiB | 1.13 MiB |
| 1155f0c | 24.14 KiB | 1.16 MiB | 1.13 MiB |
| 8180609 | 24.14 KiB | 1.16 MiB | 1.13 MiB |
| 151b3ee | 24.14 KiB | 1.15 MiB | 1.13 MiB |
| ae8cece | 24.14 KiB | 1.15 MiB | 1.13 MiB |
Previous results on branch: ref/move-startoption-to-sdkinternal
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 8c1475b | 1225.40 ms | 1247.93 ms | 22.54 ms |
| 98673e9 | 1235.83 ms | 1269.64 ms | 33.81 ms |
| 898e4b2 | 1221.73 ms | 1261.21 ms | 39.48 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 8c1475b | 24.14 KiB | 1.18 MiB | 1.16 MiB |
| 98673e9 | 24.14 KiB | 1.18 MiB | 1.16 MiB |
| 898e4b2 | 24.14 KiB | 1.18 MiB | 1.16 MiB |
❌ 54 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Move startOption state from SentrySDKInternal (ObjC static vars + lock) to SentryDependencyContainer (Swift instance property). This avoids ObjC/Swift header visibility issues in SPM and moves state out of SentrySDK toward making it a stateless enum.
Move threadInspector and fileIOTracker from eager Dependencies static vars to lazy properties on SentryDependencyContainer. The eager initialization caused a deadlock: container init triggered Dependencies.fileIOTracker → Dependencies.threadInspector → SentryThreadInspector.init() → SentryDependencyContainer .sharedInstance() → re-entered dispatch_once for the static instance.
Member
Author
|
@sentry review |
The property was left unprotected after moving from SentrySDK (where it had startOptionLock) to SentryDependencyContainer. Background threads reading options (e.g. SentryNetworkTracker) could race with the main thread writing during SDK start/close.
philprime
marked this pull request as ready for review
June 17, 2026 13:49
philprime
enabled auto-merge (squash)
June 19, 2026 12:27
Contributor
🚨 Detected changes in high risk code 🚨High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 654c633. Configure here.
NinjaLikesCheez
approved these changes
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Moves
_startOptionstate and its lock fromSentrySDK.swiftintoSentrySDKInternal.m, makingSentrySDK.startOptionandsetStart(with:)thin passthroughs. All internal callers now useSentrySDKInternal.optionsdirectly.Motivation
Remove state from the public
SentrySDKSwift class — it should be a stateless facade. The existingSentrySDKInternal.optionsproperty already existed but was backwards (delegating toSentrySDK); this flips the ownership soSentrySDKInternalis the source of truth.Changes
SentrySDKInternal.m— owns_startOptionsstorage + lock;optionsgetter andsetStartOptions:use local synchronized storageSentrySDK+Private.h— declaressetStartOptions:(moved from test-only header)SentrySDK.swift— removes_startOptionandstartOptionLock;startOption/setStart(with:)delegate toSentrySDKInternalSentrySDK.startOption→SentrySDKInternal.optionsacross ObjC and Swift filesSentrySDKInternal+Tests.h— removed duplicatesetStartOptions:declarationRefs #8051
#skip-changelog