Skip to content

Commit

Permalink
Breaking: Remove stitchAsyncCode from SentryOption (#2973)
Browse files Browse the repository at this point in the history
Removed stitchAsyncCode from SentryOption because it is not working
Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
  • Loading branch information
brustolin authored May 2, 2023
1 parent 381380f commit 25a5e8b
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 84 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@

- Create User and Breadcrumb from map (#2820)


### Fixes

- Improved performance serializing profiling data (#2863)
- Possible crash in Core Data tracking (#2865)
- Ensure the current GPU frame rate is always reported for concurrent transaction profiling metrics (#2929)
- Move profiler metric collection to a background queue (#2956)

### Removed

- Remove experimental `stitchAsyncCode` from SentryOptions (#2973)

The `stitchAsyncCode` experimental option has been removed from `SentryOptions` as its behavior was unpredictable and sometimes resulted in unexpected errors. We plan to add it back once we fix it, but we don't have an ETA for it.

## 8.5.0

### Features
Expand Down
8 changes: 0 additions & 8 deletions Sources/Sentry/Public/SentryOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,6 @@ NS_SWIFT_NAME(Options)
*/
@property (nonatomic, assign) BOOL attachStacktrace;

/**
* @warning This is an experimental feature and may still have bugs. Turning this feature on can
* have an impact on the grouping of your issues.
* @brief When enabled, the SDK stitches stack traces of asynchronous code together.
* @note This feature is disabled by default.
*/
@property (nonatomic, assign) BOOL stitchAsyncCode;

/**
* The maximum size for each attachment in bytes.
* @note Default is 20 MiB (20 ✕ 1024 ✕ 1024 bytes).
Expand Down
4 changes: 0 additions & 4 deletions Sources/Sentry/SentryClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -688,10 +688,6 @@ - (void)setSdk:(SentryEvent *)event
[integrations addObject:trimmed];
}

if (self.options.stitchAsyncCode) {
[integrations addObject:@"StitchAsyncCode"];
}

#if SENTRY_HAS_UIKIT
if (self.options.enablePreWarmedAppStartTracing) {
[integrations addObject:@"PreWarmedAppStartTracing"];
Expand Down
6 changes: 0 additions & 6 deletions Sources/Sentry/SentryCrashIntegration.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ - (BOOL)installWithOptions:(nonnull SentryOptions *)options

[self startCrashHandler];

if (options.stitchAsyncCode) {
[self.crashAdapter installAsyncHooks];
}

[self configureScope];

return YES;
Expand Down Expand Up @@ -162,8 +158,6 @@ - (void)uninstall
installationToken = 0;
}

[self.crashAdapter uninstallAsyncHooks];

[NSNotificationCenter.defaultCenter removeObserver:self
name:NSCurrentLocaleDidChangeNotification
object:nil];
Expand Down
4 changes: 4 additions & 0 deletions Sources/Sentry/SentryCrashWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@ - (BOOL)isApplicationInForeground

- (void)installAsyncHooks
{
NSAssert(false,
@"`installAsyncHooks` should not be called, as its behavior is unpredictable and sometimes "
@"resulted in unexpected errors.");
sentrycrash_install_async_hooks();
}

- (void)uninstallAsyncHooks
{
NSAssert(false, @"`uninstallAsyncHooks` should not be called");
sentrycrash_deactivate_async_hooks();
}

Expand Down
4 changes: 0 additions & 4 deletions Sources/Sentry/SentryOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ - (instancetype)init
self.enableWatchdogTerminationTracking = YES;
self.sessionTrackingIntervalMillis = [@30000 unsignedIntValue];
self.attachStacktrace = YES;
self.stitchAsyncCode = NO;
self.maxAttachmentSize = 20 * 1024 * 1024;
self.sendDefaultPii = NO;
self.enableAutoPerformanceTracing = YES;
Expand Down Expand Up @@ -321,9 +320,6 @@ - (BOOL)validateOptions:(NSDictionary<NSString *, id> *)options
[self setBool:options[@"attachStacktrace"]
block:^(BOOL value) { self->_attachStacktrace = value; }];

[self setBool:options[@"stitchAsyncCode"]
block:^(BOOL value) { self->_stitchAsyncCode = value; }];

if ([options[@"maxAttachmentSize"] isKindOfClass:[NSNumber class]]) {
self.maxAttachmentSize = [options[@"maxAttachmentSize"] unsignedIntValue];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,33 +185,7 @@ class SentryCrashIntegrationTests: NotificationCenterTestCase {
XCTAssertNil(fileManager.readCurrentSession())
XCTAssertNil(fileManager.readCrashedSession())
}

func testInstall_WhenStitchAsyncCallsEnabled_CallsInstallAsyncHooks() {
let sut = fixture.getSut()

let options = Options()
options.stitchAsyncCode = true
sut.install(with: options)

XCTAssertTrue(fixture.sentryCrash.installAsyncHooksCalled)
}

func testInstall_WhenStitchAsyncCallsDisabled_DoesNotCallInstallAsyncHooks() {
fixture.getSut().install(with: Options())

XCTAssertFalse(fixture.sentryCrash.installAsyncHooksCalled)
}

func testUninstall_CallsUninstallAsyncHooks() {
let sut = fixture.getSut()

sut.install(with: Options())

sut.uninstall()

XCTAssertTrue(fixture.sentryCrash.uninstallAsyncHooksCalled)
}


func testUninstall_DoesNotUpdateLocale_OnLocaleDidChangeNotification() {
let (sut, hub) = givenSutWithGlobalHubAndCrashWrapper()

Expand Down
6 changes: 0 additions & 6 deletions Tests/SentryTests/SentryClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1133,12 +1133,6 @@ class SentryClientTest: XCTestCase {
}
}

func testTrackStitchAsyncCode() {
testFeatureTrackingAsIntegration(integrationName: "StitchAsyncCode") {
$0.stitchAsyncCode = true
}
}

#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)
func testTrackPreWarmedAppStartTracking() {
testFeatureTrackingAsIntegration(integrationName: "PreWarmedAppStartTracing") {
Expand Down
17 changes: 1 addition & 16 deletions Tests/SentryTests/SentryCrash/SentryStacktraceBuilderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,7 @@ class SentryStacktraceBuilderTests: XCTestCase {

XCTAssertTrue(filteredFrames.count == 1, "The frames must be ordered from caller to callee, or oldest to youngest.")
}

func testAsyncStacktraces() throws {
SentrySDK.start { options in
options.dsn = TestConstants.dsnAsString(username: "SentryStacktraceBuilderTests")
options.stitchAsyncCode = true
}

let expect = expectation(description: "testAsyncStacktraces")

fixture.queue.async {
self.asyncFrame1(expect: expect)
}

wait(for: [expect], timeout: 2)
}


func asyncFrame1(expect: XCTestExpectation) {
fixture.queue.asyncAfter(deadline: DispatchTime.now()) {
self.asyncFrame2(expect: expect)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ class SentryThreadInspectorTests: XCTestCase {
XCTAssertTrue(30 < stacktrace?.frames.count ?? 0, "Not enough stacktrace frames.")
}

func testStacktraceHasFrames_forEveryThread_withStitchAsyncOn() {
SentrySDK.start { $0.stitchAsyncCode = true }
assertStackForEveryThread()
}

func testStacktraceHasFrames_forEveryThread() {
assertStackForEveryThread()
}
Expand Down
7 changes: 0 additions & 7 deletions Tests/SentryTests/SentryOptionsTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,6 @@ - (void)testAttachStackTrace
[self testBooleanField:@"attachStacktrace"];
}

- (void)testStitchAsyncCodeDisabledPerDefault
{
[self testBooleanField:@"stitchAsyncCode" defaultValue:NO];
}

- (void)testEnableIOTracking
{
[self testBooleanField:@"enableFileIOTracing" defaultValue:YES];
Expand Down Expand Up @@ -517,7 +512,6 @@ - (void)testNSNull_SetsDefaultValue
@"enableOutOfMemoryTracking" : [NSNull null],
@"sessionTrackingIntervalMillis" : [NSNull null],
@"attachStacktrace" : [NSNull null],
@"stitchAsyncCode" : [NSNull null],
@"maxAttachmentSize" : [NSNull null],
@"sendDefaultPii" : [NSNull null],
@"enableAutoPerformanceTracing" : [NSNull null],
Expand Down Expand Up @@ -569,7 +563,6 @@ - (void)assertDefaultValues:(SentryOptions *)options
XCTAssertEqual(YES, options.enableWatchdogTerminationTracking);
XCTAssertEqual([@30000 unsignedIntValue], options.sessionTrackingIntervalMillis);
XCTAssertEqual(YES, options.attachStacktrace);
XCTAssertEqual(NO, options.stitchAsyncCode);
XCTAssertEqual(20 * 1024 * 1024, options.maxAttachmentSize);
XCTAssertEqual(NO, options.sendDefaultPii);
XCTAssertTrue(options.enableAutoPerformanceTracing);
Expand Down

0 comments on commit 25a5e8b

Please sign in to comment.