[英]CFNetwork crashes app if URLRequest timeout then user authenticates via Kerberos
I develop an enterprise iOS application that uses kerberos for authentication. 我开发了一个使用kerberos进行身份验证的企业级iOS应用程序。 I have a
timeoutInterval = 30
for each request. 对于每个请求,我都有一个
timeoutInterval = 30
。 Authentication and url requests work just fine if user enters the password and passes the password verification before the request timeout. 如果用户在请求超时之前输入密码并通过密码验证,则身份验证和url请求就可以正常工作。 If user enters the password after the timeout (30+ seconds after iOS prompts user to), CFNetwork crashes App next time that application calls a web service, as seen below.
如果用户在超时后(iOS提示用户输入30秒钟以上)输入密码,则CFNetwork下次该应用程序调用Web服务时会使App崩溃,如下所示。
I am not sure what causes the issue. 我不确定是什么原因引起的。
Date/Time: 2017-01-24T03:16:42Z
Launch Time: 2017-01-24T03:16:03Z
OS Version: iPhone OS 10.0.2 (14A456)
Report Version: 104
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x68
Crashed Thread: 4
Thread 0:
0 libsystem_kernel.dylib 0x0000000189d8816c mach_msg_trap + 8
1 CoreFoundation 0x000000018ad85cec __CFRunLoopServiceMachPort + 188
2 CoreFoundation 0x000000018ad83908 __CFRunLoopRun + 1128
3 CoreFoundation 0x000000018acb2048 CFRunLoopRunSpecific + 440
4 GraphicsServices 0x000000018c735198 GSEventRunModal + 176
5 UIKit 0x0000000190c85628 -[UIApplication _run] + 680
6 UIKit 0x0000000190c80360 UIApplicationMain + 204
7 SampleiOSApp 0x00000001000301bc main (AppDelegate.swift:15)
8 libdyld.dylib 0x0000000189c945b8 start + 0
Thread 1:
0 libsystem_kernel.dylib 0x0000000189da6a88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000189e68db4 start_wqthread + 0
Thread 2:
0 libsystem_kernel.dylib 0x0000000189da6a88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000189e68db4 start_wqthread + 0
Thread 3:
0 libsystem_kernel.dylib 0x0000000189d8816c mach_msg_trap + 8
1 CoreFoundation 0x000000018ad85cec __CFRunLoopServiceMachPort + 188
2 CoreFoundation 0x000000018ad83908 __CFRunLoopRun + 1128
3 CoreFoundation 0x000000018acb2048 CFRunLoopRunSpecific + 440
4 Foundation 0x000000018b7c0b1c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 300
5 Foundation 0x000000018b7e160c -[NSRunLoop(NSRunLoop) runUntilDate:] + 92
6 UIKit 0x00000001915fac7c -[UIEventFetcher threadMain] + 132
7 Foundation 0x000000018b8be50c __NSThread__start__ + 1020
8 libsystem_pthread.dylib 0x0000000189e6b860 _pthread_body + 236
9 libsystem_pthread.dylib 0x0000000189e6b770 _pthread_start + 280
10 libsystem_pthread.dylib 0x0000000189e68dbc thread_start + 0
Thread 4 Crashed:
0 CFNetwork 0x000000018b51ae60 std::__1::__hash_const_iterator<std::__1::__hash_node<std::__1::__hash_value_type<AuthenticationState::AuthInfoType, std::__1::unique_ptr<AuthenticationInfo, std::__1::default_delete<AuthenticationInfo> > >, void*>*> std::__1::__hash_table<std::__1::__hash_value_type<AuthenticationState::AuthInfoType, std::__1::unique_ptr<AuthenticationInfo, std::__1::default_delete<AuthenticationInfo> > >, std::__1::__unordered_map_hasher<AuthenticationState::AuthInfoType, std::__1::__hash_value_type<AuthenticationState::AuthInfoType, std::__1::unique_ptr<AuthenticationInfo, std::__1::default_delete<AuthenticationInfo> > >, AuthenticationState::AuthInfoTypeHasher, true>, std::__1::__unordered_map_equal<AuthenticationState::AuthInfoType, std::__1::__hash_value_type<AuthenticationState::AuthInfoType, std::__1::unique_ptr<AuthenticationInfo, std::__1::default_delete<AuthenticationInfo> > >, std::__1::equal_to<AuthenticationState::AuthInfoType>, true>, std::__1::allocator<std::__1::__hash_value_type<AuthenticationState::AuthInfoType, std::__1::unique_ptr<AuthenticationInfo, std::__1::default_delete<AuthenticationInfo> > > > >::find<AuthenticationState::AuthInfoType>(AuthenticationState::AuthInfoType const&) const + 0
1 CFNetwork 0x000000018b516b90 AuthenticationState::updateState(HTTPResponseMessage*, _CFURLAuthChallenge*, _CFURLCredential const*, __SecTrust*) + 148
2 CFNetwork 0x000000018b4f8724 HTTPProtocol::_protocolInterface_useCredential(_CFURLCredential const*, _CFURLAuthChallenge*) + 880
3 CFNetwork 0x000000018b4f7008 ___ZN12HTTPProtocol19askAccountsForCredsEh_block_invoke_2 + 240
4 libdispatch.dylib 0x0000000189c611c0 _dispatch_client_callout + 12
5 libdispatch.dylib 0x0000000189c6cb24 _dispatch_block_invoke_direct + 372
6 CFNetwork 0x000000018b5f2e98 RunloopBlockContext::_invoke_block(void const*, void*) + 32
7 CoreFoundation 0x000000018acb19a8 CFArrayApplyFunction + 64
8 CFNetwork 0x000000018b5f2d7c RunloopBlockContext::perform() + 132
9 CFNetwork 0x000000018b5f40a4 MultiplexerSource::perform() + 308
10 CFNetwork 0x000000018b5f3e10 MultiplexerSource::_perform(void*) + 60
11 CoreFoundation 0x000000018ad86278 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 20
12 CoreFoundation 0x000000018ad85bc0 __CFRunLoopDoSources0 + 520
13 CoreFoundation 0x000000018ad837c0 __CFRunLoopRun + 800
14 CoreFoundation 0x000000018acb2048 CFRunLoopRunSpecific + 440
15 CFNetwork 0x000000018b49fcec +[NSURLConnection(Loader) _resourceLoadLoop:] + 332
16 Foundation 0x000000018b8be50c __NSThread__start__ + 1020
17 libsystem_pthread.dylib 0x0000000189e6b860 _pthread_body + 236
18 libsystem_pthread.dylib 0x0000000189e6b770 _pthread_start + 280
19 libsystem_pthread.dylib 0x0000000189e68dbc thread_start + 0
My code for the request is as follows: 我的请求代码如下:
let manager = Alamofire.SessionManager.default
manager.retrier = RetryingManager()
let request: Alamofire.Request = manager.request(httpRequest as! URLRequestConvertible)
.validate(statusCode: 200..<300)
.validate(contentType: ["application/json"])
.responseObject(queue: queue, completionHandler: {
(response: DataResponse<T>) in
if let JSON = response.result.value {
DispatchQueue.main.async {
debugPrint("JSON: \(JSON)")
// callback with the data
completion(JSON, nil)
}
} else if let resultError = response.result.error {
let errorMessage = WebServerErrorHelper.createErrorMessage(resultError: resultError, statusCode: response.response?.statusCode, serverData: response.data)
DispatchQueue.main.async {
completion(nil, errorMessage)
}
}
})
Here queue
is a concurrent DispatchQueue
and timeInterval
is set as 30 for httpRequest
. 这里的
queue
是一个并发的DispatchQueue
并且httpRequest
timeInterval
设置为30。 I do not have a clue how to solve the problem. 我不知道如何解决问题。 Thanks in advance.
提前致谢。
这是CFNetwork
中的错误,已在iOS 10.3.3中修复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.