Skip to content

Commit 420c705

Browse files
authored
Revert "Not suspend threads for on-demand fatal thread recording (#14391)"
This reverts commit 4ed50a9.
1 parent 2e1a8f7 commit 420c705

File tree

10 files changed

+14
-48
lines changed

10 files changed

+14
-48
lines changed

Crashlytics/CHANGELOG.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Unreleased
2-
- [fixed] Made on-demand fatal recording thread suspension configurable through setting to imrpove performance and avoid audio glitch on Unity. Change is for framework only.
3-
41
# 11.7.0
52
- [fixed] Updated `upload-symbols` to version 3.20, wait for `debug.dylib` DWARF content getting generated when build with `--build-phase` option. Added `debug.dylib` DWARF content to run script input file list for user who enabled user script sandboxing (#14054).
63
- [fixed] Updated all memory allocation from `malloc()` to `calloc()` (#14209).

Crashlytics/Crashlytics/Handlers/FIRCLSException.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ void FIRCLSExceptionRaiseTestCppException(void) __attribute((noreturn));
6363
void FIRCLSExceptionRecordModel(FIRExceptionModel* exceptionModel, NSString* rolloutsInfoJSON);
6464
NSString* FIRCLSExceptionRecordOnDemandModel(FIRExceptionModel* exceptionModel,
6565
int previousRecordedOnDemandExceptions,
66-
int previousDroppedOnDemandExceptions,
67-
BOOL shouldSuspendThread);
66+
int previousDroppedOnDemandExceptions);
6867
void FIRCLSExceptionRecordNSException(NSException* exception);
6968
void FIRCLSExceptionRecord(FIRCLSExceptionType type,
7069
const char* name,
@@ -77,8 +76,7 @@ NSString* FIRCLSExceptionRecordOnDemand(FIRCLSExceptionType type,
7776
NSArray<FIRStackFrame*>* frames,
7877
BOOL fatal,
7978
int previousRecordedOnDemandExceptions,
80-
int previousDroppedOnDemandExceptions,
81-
BOOL shouldSuspendThread);
79+
int previousDroppedOnDemandExceptions);
8280
#endif
8381

8482
__END_DECLS

Crashlytics/Crashlytics/Handlers/FIRCLSException.mm

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,14 @@ void FIRCLSExceptionRecordModel(FIRExceptionModel *exceptionModel, NSString *rol
9191

9292
NSString *FIRCLSExceptionRecordOnDemandModel(FIRExceptionModel *exceptionModel,
9393
int previousRecordedOnDemandExceptions,
94-
int previousDroppedOnDemandExceptions,
95-
BOOL shouldSuspendThread) {
94+
int previousDroppedOnDemandExceptions) {
9695
const char *name = [[exceptionModel.name copy] UTF8String];
9796
const char *reason = [[exceptionModel.reason copy] UTF8String] ?: "";
9897

9998
return FIRCLSExceptionRecordOnDemand(FIRCLSExceptionTypeCustom, name, reason,
10099
[exceptionModel.stackTrace copy], exceptionModel.isFatal,
101100
previousRecordedOnDemandExceptions,
102-
previousDroppedOnDemandExceptions, shouldSuspendThread);
101+
previousDroppedOnDemandExceptions);
103102
}
104103

105104
void FIRCLSExceptionRecordNSException(NSException *exception) {
@@ -236,7 +235,7 @@ void FIRCLSExceptionRecord(FIRCLSExceptionType type,
236235
FIRCLSExceptionWrite(&file, type, name, reason, frames, nil);
237236

238237
// We only want to do this work if we have the expectation that we'll actually crash
239-
FIRCLSHandler(&file, mach_thread_self(), NULL, YES);
238+
FIRCLSHandler(&file, mach_thread_self(), NULL);
240239

241240
FIRCLSFileClose(&file);
242241
});
@@ -259,8 +258,7 @@ void FIRCLSExceptionRecord(FIRCLSExceptionType type,
259258
NSArray<FIRStackFrame *> *frames,
260259
BOOL fatal,
261260
int previousRecordedOnDemandExceptions,
262-
int previousDroppedOnDemandExceptions,
263-
BOOL shouldSuspendThread) {
261+
int previousDroppedOnDemandExceptions) {
264262
if (!FIRCLSContextIsInitialized()) {
265263
return nil;
266264
}
@@ -355,8 +353,7 @@ void FIRCLSExceptionRecord(FIRCLSExceptionType type,
355353
return nil;
356354
}
357355
FIRCLSExceptionWrite(&file, type, name, reason, frames, nil);
358-
359-
FIRCLSHandler(&file, mach_thread_self(), NULL, shouldSuspendThread);
356+
FIRCLSHandler(&file, mach_thread_self(), NULL);
360357
FIRCLSFileClose(&file);
361358

362359
// Return the path to the new report.

Crashlytics/Crashlytics/Handlers/FIRCLSHandler.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020

2121
__BEGIN_DECLS
2222

23-
void FIRCLSHandler(FIRCLSFile* file,
24-
thread_t crashedThread,
25-
void* uapVoid,
26-
bool shouldSuspendThread);
23+
void FIRCLSHandler(FIRCLSFile* file, thread_t crashedThread, void* uapVoid);
2724

2825
__END_DECLS

Crashlytics/Crashlytics/Handlers/FIRCLSHandler.m

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,12 @@
2222

2323
#import "Crashlytics/Crashlytics/Controllers/FIRCLSReportManager_Private.h"
2424

25-
void FIRCLSHandler(FIRCLSFile* file,
26-
thread_t crashedThread,
27-
void* uapVoid,
28-
bool shouldSuspendThread) {
25+
void FIRCLSHandler(FIRCLSFile* file, thread_t crashedThread, void* uapVoid) {
2926
FIRCLSProcess process;
3027

3128
FIRCLSProcessInit(&process, crashedThread, uapVoid);
3229

33-
if (shouldSuspendThread) {
34-
FIRCLSProcessSuspendAllOtherThreads(&process);
35-
}
30+
FIRCLSProcessSuspendAllOtherThreads(&process);
3631

3732
FIRCLSProcessRecordAllThreads(&process, file);
3833

@@ -50,7 +45,5 @@ void FIRCLSHandler(FIRCLSFile* file,
5045
// Store a crash file marker to indicate that a crash has occurred
5146
FIRCLSCreateCrashedMarkerFile();
5247

53-
if (shouldSuspendThread) {
54-
FIRCLSProcessResumeAllOtherThreads(&process);
55-
}
48+
FIRCLSProcessResumeAllOtherThreads(&process);
5649
}

Crashlytics/Crashlytics/Handlers/FIRCLSMachException.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ static bool FIRCLSMachExceptionRecord(FIRCLSMachExceptionReadContext* context,
520520

521521
FIRCLSFileWriteSectionEnd(&file);
522522

523-
FIRCLSHandler(&file, message->thread.name, NULL, true);
523+
FIRCLSHandler(&file, message->thread.name, NULL);
524524

525525
FIRCLSFileClose(&file);
526526

Crashlytics/Crashlytics/Handlers/FIRCLSSignal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ static void FIRCLSSignalRecordSignal(int savedErrno, siginfo_t *info, void *uapV
286286

287287
FIRCLSFileWriteSectionEnd(&file);
288288

289-
FIRCLSHandler(&file, mach_thread_self(), uapVoid, true);
289+
FIRCLSHandler(&file, mach_thread_self(), uapVoid);
290290

291291
FIRCLSFileClose(&file);
292292
}

Crashlytics/Crashlytics/Models/FIRCLSOnDemandModel.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,8 @@ - (void)implementOnDemandUploadDelay:(int)delay {
178178
}
179179

180180
- (NSString *)recordOnDemandExceptionWithModel:(FIRExceptionModel *)exceptionModel {
181-
BOOL shouldSuspendThread = self.settings.onDemandThreadSuspensionEnabled;
182181
return FIRCLSExceptionRecordOnDemandModel(exceptionModel, self.recordedOnDemandExceptionCount,
183-
self.droppedOnDemandExceptionCount,
184-
shouldSuspendThread);
182+
self.droppedOnDemandExceptionCount);
185183
}
186184

187185
- (int)droppedOnDemandExceptionCount {

Crashlytics/Crashlytics/Models/FIRCLSSettings.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,6 @@ NS_ASSUME_NONNULL_BEGIN
121121
*/
122122
@property(nonatomic, readonly) uint32_t onDemandBackoffStepDuration;
123123

124-
/**
125-
* When this is true, Crashlytics will suspend all threads to do on-demand fatal recording.
126-
*/
127-
@property(nonatomic, readonly) BOOL onDemandThreadSuspensionEnabled;
128-
129124
@end
130125

131126
NS_ASSUME_NONNULL_END

Crashlytics/Crashlytics/Models/FIRCLSSettings.m

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -357,13 +357,4 @@ - (uint32_t)onDemandBackoffStepDuration {
357357
return 6; // step duration for exponential backoff
358358
}
359359

360-
- (BOOL)onDemandThreadSuspensionEnabled {
361-
NSNumber *value = self.settingsDictionary[@"on_demand_thread_recording_suspension_enabled"];
362-
363-
if (value != nil) {
364-
return value.boolValue;
365-
}
366-
367-
return YES;
368-
}
369360
@end

0 commit comments

Comments
 (0)