Closed tamwei closed 3 months ago
Hi @tamwei Thank you for reporting the issue. Give us some time to take a look at this.
Hello @tamwei, unfortunately we were unable to reproduce the error message.
Could you share more information?
How do you connect PLCrashReporter to your project? How do you debug it? Could you provide a sample app that reproduces this error message?
hello @aleksandr-dorofeev, I probably know the reason for this issue, because I initialize PLCrashReporter in an asynchronous global queue.
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(queue, ^{
[self enableCrashReporter];
});
}
- (void)enableCrashReporter {
if(_crashReporter) {
return;
}
PLCrashReporterSignalHandlerType handleType = PLCrashReporterSignalHandlerTypeBSD;
PLCrashReporterSymbolicationStrategy strategy = PLCrashReporterSymbolicationStrategySymbolTable;
PLCrashReporterConfig *config = [[PLCrashReporterConfig alloc] initWithSignalHandlerType:handleType symbolicationStrategy:strategy shouldRegisterUncaughtExceptionHandler:YES];
_crashReporter = [[PLCrashReporter alloc] initWithConfiguration:config];
NSError *error;
PLCrashReporterCallbacks cb = {
.version = 0,
.context = (void *)0xABABABAB,
.handleSignal = callbackSigHandler};
[self.crashReporter setCrashCallbacks:&cb];
if (![self.crashReporter enableCrashReporterAndReturnError:&error]) {
NSLog(@"error:%@",error);
}
}
And then I verified the code below. After the app starts, I switch between other programs and this app many times (let them get the focus), and the above issue will still be triggered.
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(queue, ^{
self->_sigstk.ss_size = SIGSTKSZ;
self->_sigstk.ss_sp = malloc(self->_sigstk.ss_size);
self->_sigstk.ss_flags = 0;
sigaltstack(&self->_sigstk, 0);
});
}
Thanks for the additional information. Could you please clarify how you add PLCrashReporter to your project? Using SPM/Carthage/CocoaPods?
Sorry for the late reply. I downloaded PLCrashReporter from here and manually added it to the sample below.
Thanks for providing the sample app. It turned out to reproduce the error on our side. We've filed an item on our internal board for this request. Will update this thread once got results.
@aleksandr-dorofeev Thank you every much.
As we do not have plans to fix this bug in the next year, I'm closing the issue.
Description
When I enable
Address Sanitizer
andDetect use of stack after return
, Xcode breakpoint with message:After I use
memory history 0x000108028800
, I found that the problem may be caused by line 288 of PLCrashSignalHandler.mm (https://github.com/microsoft/plcrashreporter/blob/master/Source/PLCrashSignalHandler.mm#L288)Repro Steps
Address Sanitizer
andDetect use of stack after return
Details