Skip to content

Commit

Permalink
Merge pull request #1064 from bugsnag/release-v6.8.3
Browse files Browse the repository at this point in the history
Release v6.8.3
  • Loading branch information
nickdowell committed Apr 7, 2021
2 parents de7105f + 6733a3f commit 04e6ab8
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 13 deletions.
20 changes: 20 additions & 0 deletions .buildkite/pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,26 @@ steps:
--tags='not @skip_macos'
--fail-fast

- label: ':apple: macOS 10.13 full end-to-end tests'
depends_on:
- cocoa_fixture
timeout_in_minutes: 60
agents:
queue: opensource-mac-cocoa-10.13
plugins:
artifacts#v1.3.0:
download: ["features/fixtures/macos/output/macOSTestApp.zip"]
upload: ["macOSTestApp.log"]
commands:
- bundle install
- bundle exec maze-runner
--farm=local
--os=macos
--os-version=10.13
--app=macOSTestApp
--tags='not @skip_macos'
--fail-fast

- label: ':apple: macOS 10.14 full end-to-end tests'
depends_on:
- cocoa_fixture
Expand Down
4 changes: 2 additions & 2 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ author_url: "https://www.bugsnag.com"
author: "Bugsnag Inc"
clean: false # avoid deleting docs/.git
framework_root: "Bugsnag"
github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa/tree/v6.8.2/Bugsnag"
github_file_prefix: "https://github.com/bugsnag/bugsnag-cocoa/tree/v6.8.3/Bugsnag"
github_url: "https://github.com/bugsnag/bugsnag-cocoa"
hide_documentation_coverage: true
module: "Bugsnag"
module_version: "6.8.2"
module_version: "6.8.3"
objc: true
output: "docs"
readme: "README.md"
Expand Down
4 changes: 2 additions & 2 deletions Bugsnag.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Bugsnag",
"version": "6.8.2",
"version": "6.8.3",
"summary": "The Bugsnag crash reporting framework for Apple platforms.",
"homepage": "https://bugsnag.com",
"license": "MIT",
Expand All @@ -9,7 +9,7 @@
},
"source": {
"git": "https://github.com/bugsnag/bugsnag-cocoa.git",
"tag": "v6.8.2"
"tag": "v6.8.3"
},
"frameworks": [
"Foundation",
Expand Down
2 changes: 1 addition & 1 deletion Bugsnag/Client/BugsnagClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ - (void)notifyInternal:(BugsnagEvent *_Nonnull)event
[self.eventUploader storeEvent:event];
// Replicate previous delivery mechanism's behaviour of waiting 1 second before delivering the event.
// This should prevent potential duplicate uploads of unhandled errors where the app subsequently terminates.
[self.eventUploader performSelector:@selector(uploadStoredEvents) withObject:nil afterDelay:1];
[self.eventUploader uploadStoredEventsAfterDelay:1];
} else {
[self.eventUploader uploadEvent:event completionHandler:nil];
}
Expand Down
12 changes: 10 additions & 2 deletions Bugsnag/Delivery/BSGEventUploadOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,16 @@ - (void)runWithDelegate:(id<BSGEventUploadOperationDelegate>)delegate completion
}
}

NSDictionary *eventPayload = [event toJsonWithRedactedKeys:configuration.redactedKeys];

NSDictionary *eventPayload;
@try {
eventPayload = [event toJsonWithRedactedKeys:configuration.redactedKeys];
} @catch (NSException *exception) {
bsg_log_err(@"Discarding event %@ because an exception was thrown by -toJsonWithRedactedKeys: %@", self.name, exception);
[self deleteEvent];
completionHandler();
return;
}

NSString *apiKey = event.apiKey ?: configuration.apiKey;

NSMutableDictionary *requestPayload = [NSMutableDictionary dictionary];
Expand Down
2 changes: 2 additions & 0 deletions Bugsnag/Delivery/BSGEventUploader.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ NS_ASSUME_NONNULL_BEGIN

- (void)uploadStoredEvents;

- (void)uploadStoredEventsAfterDelay:(NSTimeInterval)delay;

- (void)uploadLatestStoredEvent:(void (^)(void))completionHandler;

@end
Expand Down
7 changes: 7 additions & 0 deletions Bugsnag/Delivery/BSGEventUploader.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ - (void)uploadStoredEvents {
}];
}

- (void)uploadStoredEventsAfterDelay:(NSTimeInterval)delay {
dispatch_queue_t queue = dispatch_get_global_queue(QOS_CLASS_UTILITY, 0);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC)), queue, ^{
[self uploadStoredEvents];
});
}

- (void)uploadLatestStoredEvent:(void (^)(void))completionHandler {
NSString *latestFile = [self sortedEventFiles].lastObject;
BSGEventUploadFileOperation *operation = latestFile ? [self uploadOperationsWithFiles:@[latestFile]].lastObject : nil;
Expand Down
7 changes: 7 additions & 0 deletions Bugsnag/Helpers/BSGAppHangDetector.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#import <Bugsnag/BugsnagConfiguration.h>
#import <Bugsnag/BugsnagErrorTypes.h>

#import "BSG_KSMach.h"
#import "BugsnagLogger.h"
#import "BugsnagThread+Recording.h"
#import "BugsnagThread+Private.h"
Expand Down Expand Up @@ -74,6 +75,12 @@ - (void)startWithDelegate:(id<BSGAppHangDetectorDelegate>)delegate {
dispatch_time_t timeout = dispatch_time(now, (int64_t)(threshold * NSEC_PER_SEC));
dispatch_after(after, backgroundQueue, ^{
if (dispatch_semaphore_wait(semaphore, timeout) != 0) {
if (bsg_ksmachisBeingTraced()) {
bsg_log_debug("Ignoring app hang because debugger is attached");
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
return;
}

bsg_log_info("App hang detected");

NSArray<BugsnagThread *> *threads = nil;
Expand Down
16 changes: 14 additions & 2 deletions Bugsnag/Payload/BugsnagEvent.m
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,11 @@ - (NSDictionary *)toJsonWithRedactedKeys:(NSSet *)redactedKeys {

// add metadata
NSMutableDictionary *metadata = [[[self metadata] toDictionary] mutableCopy];
event[BSGKeyMetadata] = [self sanitiseMetadata:metadata redactedKeys:redactedKeys];
@try {
event[BSGKeyMetadata] = [self sanitiseMetadata:metadata redactedKeys:redactedKeys];
} @catch (NSException *exception) {
bsg_log_err(@"An exception was thrown while sanitising metadata: %@", exception);
}

event[BSGKeyDevice] = [self.device toDictionary];
event[BSGKeyApp] = [self.app toDict];
Expand Down Expand Up @@ -605,7 +609,15 @@ - (NSDictionary *)toJsonWithRedactedKeys:(NSSet *)redactedKeys {

- (NSMutableDictionary *)sanitiseMetadata:(NSMutableDictionary *)metadata redactedKeys:(NSSet *)redactedKeys {
for (NSString *sectionKey in [metadata allKeys]) {
metadata[sectionKey] = [metadata[sectionKey] mutableCopy];
if ([metadata[sectionKey] isKindOfClass:[NSDictionary class]]) {
metadata[sectionKey] = [metadata[sectionKey] mutableCopy];
} else {
NSString *message = [NSString stringWithFormat:@"Expected an NSDictionary but got %@ %@",
NSStringFromClass([metadata[sectionKey] class]), metadata[sectionKey]];
bsg_log_err(@"%@", message);
// Leave an indication of the error in the payload for diagnosis
metadata[sectionKey] = [@{@"bugsnag.error": message} mutableCopy];
}
NSMutableDictionary *section = metadata[sectionKey];

if (section != nil) { // redact sensitive metadata values
Expand Down
2 changes: 1 addition & 1 deletion Bugsnag/Payload/BugsnagNotifier.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ - (instancetype)init {
#else
self.name = @"Bugsnag Objective-C";
#endif
self.version = @"6.8.2";
self.version = @"6.8.3";
self.url = @"https://github.com/bugsnag/bugsnag-cocoa";
self.dependencies = [NSMutableArray new];
}
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Changelog
=========

## 6.8.3 (2021-04-07)

### Bug fixes

* Catch exceptions thrown while preparing JSON for upload rather than crashing.
[#1063](https://github.com/bugsnag/bugsnag-cocoa/pull/1063)

* Prevent app hangs being reported if a debugger is attached.
[#1058](https://github.com/bugsnag/bugsnag-cocoa/pull/1058)

## 6.8.2 (2021-03-31)

### Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion Framework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>6.8.2</string>
<string>6.8.3</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion Tests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>6.8.2</string>
<string>6.8.3</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.8.2
6.8.3

0 comments on commit 04e6ab8

Please sign in to comment.