iOS crash during metrics collection |
|||||
Issue descriptionA client reported an app crash after enabling CronetMetrics. The crash takes place in a 3rd party "HockeyApp" library that is used for crash reporting. Here is the stack trace: Thread 0 Crashed: 0 CoreFoundation 0x0000000182a385ec ___forwarding___ + 1416 1 CoreFoundation 0x000000018291e41c _CF_forwarding_prep_0 + 88 2 Foundation 0x00000001834646ec -[NSProxy respondsToSelector:] + 56 3 CFNetwork 0x0000000183187f94 -[NSURLSession can_delegate_task_didFinishCollectingMetrics] + 56 4 CFNetwork 0x00000001832211c8 -[__NSCFURLSessionTask _initializeTimingDataWithSessionConfiguration:] + 360 5 CFNetwork 0x000000018321e4d0 -[__NSCFURLSessionTask initWithOriginalRequest:updatedRequest:ident:session:] + 472 6 CFNetwork 0x0000000182fd8df8 -[__NSCFLocalSessionTask initWithOriginalRequest:updatedRequest:ident:session:] + 120 7 CFNetwork 0x0000000182fc1948 -[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:] + 168 [BITAuthenticator validateWithCompletion:] (BITAuthenticator.m:349)
,
Apr 18 2018
Cronet code implements [_delegate respondsToSelector...] check in the URLSessionTaskDelegateProxy initializer: https://cs.chromium.org/chromium/src/components/cronet/ios/cronet_metrics.mm?sq=package:chromium&dr&l=204 I wonder if it should be moved to - (void)URLSession:(NSURLSession*)session task:(NSURLSessionTask*)task didFinishCollectingMetrics:(NSURLSessionTaskMetrics*)metrics method where it is actually used. Since the app was compiled without Cronet debug symbols, I have requested a more detailed stack trace from the app developers.
,
Apr 19 2018
kapishnikov@: Would you mind taking ownership of this bug?
,
Apr 19 2018
,
Apr 23 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/ac571767ab0e49735c2f35b55b34b8afe6ced26b commit ac571767ab0e49735c2f35b55b34b8afe6ced26b Author: kapishnikov <kapishnikov@chromium.org> Date: Mon Apr 23 22:11:06 2018 Fixes metrics crash when a NSURLSession is created without a delegate BUG= 834401 Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet Change-Id: I431f280cb95db8b924a826740590eeb8fb1c4399 Reviewed-on: https://chromium-review.googlesource.com/1021600 Reviewed-by: Misha Efimov <mef@chromium.org> Commit-Queue: Andrei Kapishnikov <kapishnikov@chromium.org> Cr-Commit-Position: refs/heads/master@{#552853} [modify] https://crrev.com/ac571767ab0e49735c2f35b55b34b8afe6ced26b/components/cronet/ios/Cronet.mm [modify] https://crrev.com/ac571767ab0e49735c2f35b55b34b8afe6ced26b/components/cronet/ios/cronet_metrics.h [modify] https://crrev.com/ac571767ab0e49735c2f35b55b34b8afe6ced26b/components/cronet/ios/cronet_metrics.mm [modify] https://crrev.com/ac571767ab0e49735c2f35b55b34b8afe6ced26b/components/cronet/ios/test/BUILD.gn [modify] https://crrev.com/ac571767ab0e49735c2f35b55b34b8afe6ced26b/components/cronet/ios/test/cronet_metrics_test.mm [modify] https://crrev.com/ac571767ab0e49735c2f35b55b34b8afe6ced26b/components/cronet/ios/test/cronet_test_base.h
,
Apr 25 2018
,
Apr 25 2018
The client who initially reported the issue confirmed that the issue has been fixed by the CL. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by kapishnikov@chromium.org
, Apr 18 2018Looking at the "HockeyApp" sources, this is, probably, code being executed: NSURLRequest *request = [self.hockeyAppClient requestWithMethod:@"GET" path:validationPath parameters:[self validationParameters]]; NSURLSessionConfiguration *sessionConfiguration = [NSURLSessionConfiguration defaultSessionConfiguration]; __block NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfiguration]; NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { typeof(self) strongSelf = weakSelf; [session finishTasksAndInvalidate]; [strongSelf handleValidationResponseWithData:data error:error completion:completion]; }]; [task resume]; Note, that the task is created without an explicit delegate but with a completion block instead.