New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 834401 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Last visit > 30 days ago
Closed: Apr 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 2
Type: Bug



Sign in to add a comment

iOS crash during metrics collection

Project Member Reported by kapishnikov@chromium.org, Apr 18 2018

Issue description

A 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)
 
Looking 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.



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.


Cc: pkl@chromium.org
Owner: kapishnikov@chromium.org
Status: Assigned (was: Untriaged)
kapishnikov@: Would you mind taking ownership of this bug?
Status: Started (was: Assigned)
Status: Fixed (was: Started)
Status: Verified (was: Fixed)
The client who initially reported the issue confirmed that the issue has been fixed by the CL.

Sign in to add a comment