From 7e78417773a20ce02b63846129381414f753afc0 Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Tue, 25 Feb 2025 11:56:36 +0100 Subject: [PATCH 1/5] fix: move assignment of file IO span origin outside of block (#4888) --- CHANGELOG.md | 4 ++++ Sources/Sentry/SentryFileIOTracker.m | 9 +++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a135bcadc..fbf7e4ef05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ - Log message when setting user before starting the SDK (#4882) - Add experimental flag to disable swizzling of `NSData` individually (#4859) +### Fixes + +- fix: move assignment of file IO span origin outside of block (#4888) + ## 8.45.0 ### Features diff --git a/Sources/Sentry/SentryFileIOTracker.m b/Sources/Sentry/SentryFileIOTracker.m index 253354ba0d..c6f57e0501 100644 --- a/Sources/Sentry/SentryFileIOTracker.m +++ b/Sources/Sentry/SentryFileIOTracker.m @@ -194,11 +194,11 @@ - (BOOL)measureNSFileManagerCreateFileAtPath:(NSString *)path } __block id ioSpan; + NSString *spanDescription = [self transactionDescriptionForFile:path fileSize:size]; [SentrySDK.currentHub.scope useSpan:^(id _Nullable span) { - ioSpan = [span startChildWithOperation:operation - description:[self transactionDescriptionForFile:path - fileSize:size]]; - ioSpan.origin = origin; + // Keep the logic inside the `useSpan` block to a minimum, as we have noticed memory issues + // See: https://github.com/getsentry/sentry-cocoa/issues/4887 + ioSpan = [span startChildWithOperation:operation description:spanDescription]; }]; if (ioSpan == nil) { @@ -209,6 +209,7 @@ - (BOOL)measureNSFileManagerCreateFileAtPath:(NSString *)path SENTRY_LOG_DEBUG(@"Automatically started a new span with description: %@, operation: %@", ioSpan.description, operation); + ioSpan.origin = origin; [ioSpan setDataValue:path forKey:SentrySpanDataKey.filePath]; [self mainThreadExtraInfo:ioSpan]; From e13670fc4bd57c9d2065e90735c76e26d0d91dc8 Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Tue, 25 Feb 2025 11:57:46 +0100 Subject: [PATCH 2/5] chore: add warning related to SDK crashes (#4892) Co-authored-by: Karl Heinz Struggl --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fbf7e4ef05..8e96db6053 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,11 @@ ## 8.45.0 +> [!WARNING] +> We have been made aware that this version can cause crashes in certain configurations when using network tracking, file I/O tracking, or CoreData tracking features. +> We recommend staying on version 8.43.0 or disable the mentioned features until a fix is released. +> See issue [#4887](https://github.com/getsentry/sentry-cocoa/issues/4887) for more details. + ### Features - Add `showMaskPreview` to `SentrySDK.replay` api to debug replay masking (#4761) @@ -45,6 +50,11 @@ ## 8.44.0 +> [!WARNING] +> We have been made aware that this version can cause crashes in certain configurations when using network tracking, file I/O tracking, or CoreData tracking features. +> We recommend staying on version 8.43.0 or disable the mentioned features until a fix is released. +> See issue [#4887](https://github.com/getsentry/sentry-cocoa/issues/4887) for more details. + ### Fixes - Don't start the SDK inside Xcode preview (#4601) From ec0171ff801c3fec8951110a860b812628370a8b Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Tue, 25 Feb 2025 13:19:42 +0100 Subject: [PATCH 3/5] ci: Increase allowed binary size (#4895) --- Tests/Perf/metrics-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Perf/metrics-test.yml b/Tests/Perf/metrics-test.yml index 9a299bc970..8e23e8c8a4 100644 --- a/Tests/Perf/metrics-test.yml +++ b/Tests/Perf/metrics-test.yml @@ -11,4 +11,4 @@ startupTimeTest: binarySizeTest: diffMin: 200 KiB - diffMax: 800 KiB + diffMax: 850 KiB From fef57d6195923000cb38f0e64c953715bfa59209 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Tue, 25 Feb 2025 13:20:08 +0100 Subject: [PATCH 4/5] ref: Rename SentryCrashIntegrationSessionHandler (#4893) Rename from SentrySessionCrashedHandler to SentryCrashIntegrationSessionHandler, as we're going to so we can add more logic to it, which isn't only related to crashed sessions. --- Sentry.xcodeproj/project.pbxproj | 16 ++++++++-------- Sources/Sentry/SentryCrashIntegration.m | 16 ++++++++-------- ....m => SentryCrashIntegrationSessionHandler.m} | 6 +++--- ....h => SentryCrashIntegrationSessionHandler.h} | 3 +-- 4 files changed, 20 insertions(+), 21 deletions(-) rename Sources/Sentry/{SentrySessionCrashedHandler.m => SentryCrashIntegrationSessionHandler.m} (92%) rename Sources/Sentry/include/{SentrySessionCrashedHandler.h => SentryCrashIntegrationSessionHandler.h} (89%) diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index 983a68d14f..d0fa45469f 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -395,8 +395,8 @@ 7B42C48227E08F4B009B58C2 /* SentryDependencyContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B42C48127E08F4B009B58C2 /* SentryDependencyContainer.m */; }; 7B4D308A26FC616B00C94DE9 /* SentryHttpTransportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4D308926FC616B00C94DE9 /* SentryHttpTransportTests.swift */; }; 7B4E23B6251A07BD00060D68 /* SentryDispatchQueueWrapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4E23B5251A07BD00060D68 /* SentryDispatchQueueWrapperTests.swift */; }; - 7B4E23BE251A2BD500060D68 /* SentrySessionCrashedHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B4E23BD251A2BD500060D68 /* SentrySessionCrashedHandler.h */; }; - 7B4E23C2251A2C2B00060D68 /* SentrySessionCrashedHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B4E23C1251A2C2B00060D68 /* SentrySessionCrashedHandler.m */; }; + 7B4E23BE251A2BD500060D68 /* SentryCrashIntegrationSessionHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B4E23BD251A2BD500060D68 /* SentryCrashIntegrationSessionHandler.h */; }; + 7B4E23C2251A2C2B00060D68 /* SentryCrashIntegrationSessionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B4E23C1251A2C2B00060D68 /* SentryCrashIntegrationSessionHandler.m */; }; 7B4E24FC251C97B500060D68 /* SentrySession.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B4E24FB251C97B400060D68 /* SentrySession.h */; }; 7B4E375525822C4500059C93 /* SentryAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B4E375425822C4500059C93 /* SentryAttachment.h */; settings = {ATTRIBUTES = (Public, ); }; }; 7B4E375B2582313100059C93 /* SentryAttachmentTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4E375A2582313100059C93 /* SentryAttachmentTests.swift */; }; @@ -1475,8 +1475,8 @@ 7B4D308926FC616B00C94DE9 /* SentryHttpTransportTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryHttpTransportTests.swift; sourceTree = ""; }; 7B4E23AE2519E13800060D68 /* SentryCrashIntegration+TestInit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentryCrashIntegration+TestInit.h"; sourceTree = ""; }; 7B4E23B5251A07BD00060D68 /* SentryDispatchQueueWrapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryDispatchQueueWrapperTests.swift; sourceTree = ""; }; - 7B4E23BD251A2BD500060D68 /* SentrySessionCrashedHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySessionCrashedHandler.h; path = include/SentrySessionCrashedHandler.h; sourceTree = ""; }; - 7B4E23C1251A2C2B00060D68 /* SentrySessionCrashedHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySessionCrashedHandler.m; sourceTree = ""; }; + 7B4E23BD251A2BD500060D68 /* SentryCrashIntegrationSessionHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryCrashIntegrationSessionHandler.h; path = include/SentryCrashIntegrationSessionHandler.h; sourceTree = ""; }; + 7B4E23C1251A2C2B00060D68 /* SentryCrashIntegrationSessionHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryCrashIntegrationSessionHandler.m; sourceTree = ""; }; 7B4E24FB251C97B400060D68 /* SentrySession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentrySession.h; path = include/SentrySession.h; sourceTree = ""; }; 7B4E375425822C4500059C93 /* SentryAttachment.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryAttachment.h; path = Public/SentryAttachment.h; sourceTree = ""; }; 7B4E375A2582313100059C93 /* SentryAttachmentTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryAttachmentTests.swift; sourceTree = ""; }; @@ -3320,8 +3320,8 @@ children = ( 15360CD82432835400112302 /* SentryAutoSessionTrackingIntegration.h */, 15360CD52432832400112302 /* SentryAutoSessionTrackingIntegration.m */, - 7B4E23BD251A2BD500060D68 /* SentrySessionCrashedHandler.h */, - 7B4E23C1251A2C2B00060D68 /* SentrySessionCrashedHandler.m */, + 7B4E23BD251A2BD500060D68 /* SentryCrashIntegrationSessionHandler.h */, + 7B4E23C1251A2C2B00060D68 /* SentryCrashIntegrationSessionHandler.m */, 15360CD12432779F00112302 /* SentrySessionTracker.h */, 15360CCE2432777400112302 /* SentrySessionTracker.m */, ); @@ -4276,7 +4276,7 @@ 7BA0C04628055F8E003E0326 /* SentryTransportAdapter.h in Headers */, 63FE717720DA4C1100CDBAE8 /* SentryCrashReportWriter.h in Headers */, 84DEE86B2B686BD400A7BC17 /* SentrySamplerDecision.h in Headers */, - 7B4E23BE251A2BD500060D68 /* SentrySessionCrashedHandler.h in Headers */, + 7B4E23BE251A2BD500060D68 /* SentryCrashIntegrationSessionHandler.h in Headers */, 7B88F2FE24BC5A4C00ADF90A /* SentrySdkInfo.h in Headers */, 7BCFBD672681C95000BC27D8 /* SentryScopeObserver.h in Headers */, D81A346C291AECC7005A27A9 /* PrivateSentrySDKOnly.h in Headers */, @@ -5108,7 +5108,7 @@ 7B98D7CF25FB650F00C5A389 /* SentryWatchdogTerminationTrackingIntegration.m in Sources */, 8E5D38DD261D4A3E000D363D /* SentryPerformanceTrackingIntegration.m in Sources */, D8F016B62B962548007B9AFB /* StringExtensions.swift in Sources */, - 7B4E23C2251A2C2B00060D68 /* SentrySessionCrashedHandler.m in Sources */, + 7B4E23C2251A2C2B00060D68 /* SentryCrashIntegrationSessionHandler.m in Sources */, 9286059729A5098900F96038 /* SentryGeo.m in Sources */, D8A3649C2C91AA3300AC569B /* SentryReplayApi.m in Sources */, 7B42C48227E08F4B009B58C2 /* SentryDependencyContainer.m in Sources */, diff --git a/Sources/Sentry/SentryCrashIntegration.m b/Sources/Sentry/SentryCrashIntegration.m index ad9a3b5b51..457392c443 100644 --- a/Sources/Sentry/SentryCrashIntegration.m +++ b/Sources/Sentry/SentryCrashIntegration.m @@ -2,6 +2,7 @@ #import "SentryCrashInstallationReporter.h" #import "SentryCrashC.h" +#import "SentryCrashIntegrationSessionHandler.h" #include "SentryCrashMonitor_Signal.h" #import "SentryCrashWrapper.h" #import "SentryDispatchQueueWrapper.h" @@ -11,7 +12,6 @@ #import "SentryOptions.h" #import "SentrySDK+Private.h" #import "SentryScope+Private.h" -#import "SentrySessionCrashedHandler.h" #import "SentrySpan+Private.h" #import "SentryTracer.h" #import "SentryWatchdogTerminationLogic.h" @@ -53,7 +53,7 @@ @interface SentryCrashIntegration () @property (nonatomic, weak) SentryOptions *options; @property (nonatomic, strong) SentryDispatchQueueWrapper *dispatchQueueWrapper; @property (nonatomic, strong) SentryCrashWrapper *crashAdapter; -@property (nonatomic, strong) SentrySessionCrashedHandler *crashedSessionHandler; +@property (nonatomic, strong) SentryCrashIntegrationSessionHandler *sessionHandler; @property (nonatomic, strong) SentryCrashScopeObserver *scopeObserver; @end @@ -95,12 +95,12 @@ - (BOOL)installWithOptions:(nonnull SentryOptions *)options [[SentryWatchdogTerminationLogic alloc] initWithOptions:options crashAdapter:self.crashAdapter appStateManager:appStateManager]; - self.crashedSessionHandler = - [[SentrySessionCrashedHandler alloc] initWithCrashWrapper:self.crashAdapter - watchdogTerminationLogic:logic]; + self.sessionHandler = + [[SentryCrashIntegrationSessionHandler alloc] initWithCrashWrapper:self.crashAdapter + watchdogTerminationLogic:logic]; #else - self.crashedSessionHandler = - [[SentrySessionCrashedHandler alloc] initWithCrashWrapper:self.crashAdapter]; + self.sessionHandler = + [[SentryCrashIntegrationSessionHandler alloc] initWithCrashWrapper:self.crashAdapter]; #endif // SENTRY_HAS_UIKIT self.scopeObserver = @@ -179,7 +179,7 @@ - (void)startCrashHandler:(NSString *)cacheDirectory // there and the AutoSessionTrackingIntegration can work properly. // // This is a pragmatic and not the most optimal place for this logic. - [self.crashedSessionHandler endCurrentSessionAsCrashedWhenCrashOrWatchdogTermination]; + [self.sessionHandler endCurrentSessionAsCrashedWhenCrashOrWatchdogTermination]; // We only need to send all reports on the first initialization of SentryCrash. If // SenryCrash was deactivated there are no new reports to send. Furthermore, the diff --git a/Sources/Sentry/SentrySessionCrashedHandler.m b/Sources/Sentry/SentryCrashIntegrationSessionHandler.m similarity index 92% rename from Sources/Sentry/SentrySessionCrashedHandler.m rename to Sources/Sentry/SentryCrashIntegrationSessionHandler.m index 91f2633332..5a3cf40a41 100644 --- a/Sources/Sentry/SentrySessionCrashedHandler.m +++ b/Sources/Sentry/SentryCrashIntegrationSessionHandler.m @@ -1,4 +1,4 @@ -#import "SentrySessionCrashedHandler.h" +#import "SentryCrashIntegrationSessionHandler.h" #import "SentryClient+Private.h" #import "SentryCrashWrapper.h" #import "SentryDependencyContainer.h" @@ -9,7 +9,7 @@ #import "SentrySwift.h" #import "SentryWatchdogTerminationLogic.h" -@interface SentrySessionCrashedHandler () +@interface SentryCrashIntegrationSessionHandler () @property (nonatomic, strong) SentryCrashWrapper *crashWrapper; #if SENTRY_HAS_UIKIT @@ -18,7 +18,7 @@ @interface SentrySessionCrashedHandler () @end -@implementation SentrySessionCrashedHandler +@implementation SentryCrashIntegrationSessionHandler #if SENTRY_HAS_UIKIT - (instancetype)initWithCrashWrapper:(SentryCrashWrapper *)crashWrapper diff --git a/Sources/Sentry/include/SentrySessionCrashedHandler.h b/Sources/Sentry/include/SentryCrashIntegrationSessionHandler.h similarity index 89% rename from Sources/Sentry/include/SentrySessionCrashedHandler.h rename to Sources/Sentry/include/SentryCrashIntegrationSessionHandler.h index 3a2283b66c..d8409b7bd0 100644 --- a/Sources/Sentry/include/SentrySessionCrashedHandler.h +++ b/Sources/Sentry/include/SentryCrashIntegrationSessionHandler.h @@ -1,13 +1,12 @@ #import "SentryDefines.h" @class SentryCrashWrapper; -@class SentryDispatchQueueWrapper; #if SENTRY_HAS_UIKIT @class SentryWatchdogTerminationLogic; #endif // SENTRY_HAS_UIKIT -@interface SentrySessionCrashedHandler : NSObject +@interface SentryCrashIntegrationSessionHandler : NSObject #if SENTRY_HAS_UIKIT - (instancetype)initWithCrashWrapper:(SentryCrashWrapper *)crashWrapper From 2aacc32e4b341659303f1e8d996a790dfab95492 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Feb 2025 13:59:13 +0100 Subject: [PATCH 5/5] chore(deps): bump mikepenz/action-junit-report from 5.3.0 to 5.4.0 (#4890) Bumps [mikepenz/action-junit-report](https://github.com/mikepenz/action-junit-report) from 5.3.0 to 5.4.0. - [Release notes](https://github.com/mikepenz/action-junit-report/releases) - [Commits](https://github.com/mikepenz/action-junit-report/compare/ee6b445351cd81e2f73a16a0e52d598aeac2197f...b14027d33d3a745ccc4d6a12f649e83110b5a373) --- updated-dependencies: - dependency-name: mikepenz/action-junit-report dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 323b8f7c5f..90fc199e5f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -212,7 +212,7 @@ jobs: --scheme ${{matrix.scheme}} - name: Publish Test Report - uses: mikepenz/action-junit-report@ee6b445351cd81e2f73a16a0e52d598aeac2197f # v5.3.0 + uses: mikepenz/action-junit-report@b14027d33d3a745ccc4d6a12f649e83110b5a373 # v5.4.0 if: always() with: report_paths: "build/reports/junit.xml"