Skip to content

Commit

Permalink
Merge branch 'main' into feat/fatal-app-hangs
Browse files Browse the repository at this point in the history
  • Loading branch information
philipphofmann committed Feb 25, 2025
2 parents f24ea22 + 2aacc32 commit a3ad023
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,17 @@
- 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

> [!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)
Expand Down Expand Up @@ -42,6 +51,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)
Expand Down
16 changes: 8 additions & 8 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,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 */; };
Expand Down Expand Up @@ -1477,8 +1477,8 @@
7B4D308926FC616B00C94DE9 /* SentryHttpTransportTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryHttpTransportTests.swift; sourceTree = "<group>"; };
7B4E23AE2519E13800060D68 /* SentryCrashIntegration+TestInit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentryCrashIntegration+TestInit.h"; sourceTree = "<group>"; };
7B4E23B5251A07BD00060D68 /* SentryDispatchQueueWrapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryDispatchQueueWrapperTests.swift; sourceTree = "<group>"; };
7B4E23BD251A2BD500060D68 /* SentrySessionCrashedHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySessionCrashedHandler.h; path = include/SentrySessionCrashedHandler.h; sourceTree = "<group>"; };
7B4E23C1251A2C2B00060D68 /* SentrySessionCrashedHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySessionCrashedHandler.m; sourceTree = "<group>"; };
7B4E23BD251A2BD500060D68 /* SentryCrashIntegrationSessionHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryCrashIntegrationSessionHandler.h; path = include/SentryCrashIntegrationSessionHandler.h; sourceTree = "<group>"; };
7B4E23C1251A2C2B00060D68 /* SentryCrashIntegrationSessionHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryCrashIntegrationSessionHandler.m; sourceTree = "<group>"; };
7B4E24FB251C97B400060D68 /* SentrySession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentrySession.h; path = include/SentrySession.h; sourceTree = "<group>"; };
7B4E375425822C4500059C93 /* SentryAttachment.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryAttachment.h; path = Public/SentryAttachment.h; sourceTree = "<group>"; };
7B4E375A2582313100059C93 /* SentryAttachmentTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryAttachmentTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3323,8 +3323,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 */,
);
Expand Down Expand Up @@ -4279,7 +4279,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 */,
Expand Down Expand Up @@ -5111,7 +5111,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 */,
Expand Down
16 changes: 8 additions & 8 deletions Sources/Sentry/SentryCrashIntegration.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#import "SentryCrashInstallationReporter.h"

#import "SentryCrashC.h"
#import "SentryCrashIntegrationSessionHandler.h"
#include "SentryCrashMonitor_Signal.h"
#import "SentryCrashWrapper.h"
#import "SentryDispatchQueueWrapper.h"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import "SentrySessionCrashedHandler.h"
#import "SentryCrashIntegrationSessionHandler.h"
#import "SentryClient+Private.h"
#import "SentryCrashWrapper.h"
#import "SentryDependencyContainer.h"
Expand All @@ -9,7 +9,7 @@
#import "SentrySwift.h"
#import "SentryWatchdogTerminationLogic.h"

@interface SentrySessionCrashedHandler ()
@interface SentryCrashIntegrationSessionHandler ()

@property (nonatomic, strong) SentryCrashWrapper *crashWrapper;
#if SENTRY_HAS_UIKIT
Expand All @@ -18,7 +18,7 @@ @interface SentrySessionCrashedHandler ()

@end

@implementation SentrySessionCrashedHandler
@implementation SentryCrashIntegrationSessionHandler

#if SENTRY_HAS_UIKIT
- (instancetype)initWithCrashWrapper:(SentryCrashWrapper *)crashWrapper
Expand Down
9 changes: 5 additions & 4 deletions Sources/Sentry/SentryFileIOTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ - (BOOL)measureNSFileManagerCreateFileAtPath:(NSString *)path
}

__block id<SentrySpan> ioSpan;
NSString *spanDescription = [self transactionDescriptionForFile:path fileSize:size];
[SentrySDK.currentHub.scope useSpan:^(id<SentrySpan> _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) {
Expand All @@ -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];
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Tests/Perf/metrics-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ startupTimeTest:

binarySizeTest:
diffMin: 200 KiB
diffMax: 800 KiB
diffMax: 850 KiB

0 comments on commit a3ad023

Please sign in to comment.