AFNetworking addOperation被锁定

时间:2013-12-16 20:25:15

标签: ios multithreading afnetworking nsoperationqueue

我正在使用AFNetworking 1.3.3并遇到问题我不确定如何调试。下面是堆栈跟踪。到目前为止,该问题仅在单元测试期间重现,但这可能指向一个设计问题,这将导致其他一些“随机”时间的问题,所以我想弄明白。

下面是堆栈跟踪,日志中没有输出,应用程序就在那里。在我看来,应用程序处于死锁,但我无法弄清楚它为什么会这样。

编辑:我遗漏的一个细节是指向的执行指示:

EXC_BAD_ACCESS(code = 1, address=xxxxxx)

任何指示赞赏,谢谢,olivier

Thread 1, Queue : com.apple.main-thread
#0  0x0409e0b2 in objc_msgSend ()
#1  0x030316d4 in NSKeyValuePushPendingNotificationLocal ()
#2  0x0302f79f in NSKeyValueWillChange ()
#3  0x03005d1a in -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] ()
#4  0x0303560c in __addOperations ()
#5  0x03034f0e in -[NSOperationQueue addOperation:] ()
#6  0x0025cab7 in -[AFHTTPClient enqueueHTTPRequestOperation:] at /Users/olivier/Documents/elektra/src/elektra/third_party/AFNetworking-1.3.3/AFNetworking/AFHTTPClient.m:577
#7  0x00091598 in -[ELEDataObjectSync startConnectionWithPath:parameters:HTTPBody:HTTPMethod:] at /Users/olivier/Documents/elektra/src/elektra/elektra/data_sync/ELEDataObjectSync.m:215
#8  0x0020e762 in -[ELELoginRequest loginUser:withPassword:withCompletionBlock:] at /Users/olivier/Documents/elektra/src/elektra/elektra/data_sync/ELELoginRequest.m:34
#9  0x0023542d in -[ELEUserManager loginUser:withPassword:withCompletionBlock:] at /Users/olivier/Documents/elektra/src/elektra/elektra/user/ELEUserManager.m:74
#10 0x0be94179 in +[ELEUserManager(unitTestUtilities) signInUser:withPassword:] at /Users/olivier/Documents/elektra/src/elektra/elektra/user/ELEUserManager+unitTestUtilities.m:20
#11 0x0be9e5e5 in -[ELEUserAccountRequestTest setUp] at /Users/olivier/Documents/elektra/src/elektra/elektraTests/ELEUserAccountRequestTest.m:27
#12 0x20103266 in -[XCTestCase invokeTest] ()
#13 0x2010338d in -[XCTestCase performTest:] ()
#14 0x2010417c in -[XCTest run] ()
#15 0x20102a44 in -[XCTestSuite performTest:] ()
#16 0x2010417c in -[XCTest run] ()
#17 0x20102a44 in -[XCTestSuite performTest:] ()
#18 0x2010417c in -[XCTest run] ()
#19 0x20102a44 in -[XCTestSuite performTest:] ()
#20 0x2010417c in -[XCTest run] ()
#21 0x20105aa1 in +[XCTestProbe runTests:] ()
#22 0x0301612c in __NSFireDelayedPerform ()
#23 0x042c9bd6 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ ()
#24 0x042c95bd in __CFRunLoopDoTimer ()
#25 0x042b1628 in __CFRunLoopRun ()
#26 0x042b0ac3 in CFRunLoopRunSpecific ()
#27 0x042b08db in CFRunLoopRunInMode ()
#28 0x045659e2 in GSEventRunModal ()
#29 0x04565809 in GSEventRun ()
#30 0x0214dd3b in UIApplicationMain ()
#31 0x0000628b in main at /Users/olivier/Documents/elektra/src/elektra/elektra/main.m:49

Thread 2, Queue : com.apple.libdispatch-manager
#0  0x04ac2992 in kevent64 ()
#1  0x046eaf3e in _dispatch_mgr_invoke ()
#2  0x046eac7a in _dispatch_mgr_thread ()

Thread 3, Queue : (null)
#0  0x04ac2046 in __workq_kernreturn ()
#1  0x04a85dcf in _pthread_wqthread ()

Thread 4, Queue : (null)
#0  0x04ac2046 in __workq_kernreturn ()
#1  0x04a85dcf in _pthread_wqthread ()

Thread 5, Queue : (null)
#0  0x04ac2046 in __workq_kernreturn ()
#1  0x04a85dcf in _pthread_wqthread ()

Thread 6, Queue : (null)
#0  0x04ac2046 in __workq_kernreturn ()
#1  0x04a85dcf in _pthread_wqthread ()

Thread 7, Queue : (null)
#0  0x04abcf7a in mach_msg_trap ()
#1  0x04abc16c in mach_msg ()
#2  0x042abe49 in __CFRunLoopServiceMachPort ()
#3  0x042b13b1 in __CFRunLoopRun ()
#4  0x042b0ac3 in CFRunLoopRunSpecific ()
#5  0x042b08db in CFRunLoopRunInMode ()
#6  0x0303c9c5 in -[NSRunLoop(NSRunLoop) runMode:beforeDate:] ()
#7  0x02fd88d1 in -[NSRunLoop(NSRunLoop) run] ()
#8  0x0036660b in +[TFURLConnectionOperation _runNetworkThread:] ()
#9  0x03037597 in -[NSThread main] ()
#10 0x030374f6 in __NSThread__main__ ()
#11 0x04a845fb in _pthread_body ()
#12 0x04a84485 in _pthread_start ()

Thread 8 com.apple.NSURLConnectionLoader, Queue : (null)
#0  0x04abcf7a in mach_msg_trap ()
#1  0x04abc16c in mach_msg ()
#2  0x042abe49 in __CFRunLoopServiceMachPort ()
#3  0x042b13b1 in __CFRunLoopRun ()
#4  0x042b0ac3 in CFRunLoopRunSpecific ()
#5  0x042b08db in CFRunLoopRunInMode ()
#6  0x02fdb9de in +[NSURLConnection(Loader) _resourceLoadLoop:] ()
#7  0x03037597 in -[NSThread main] ()
#8  0x030374f6 in __NSThread__main__ ()
#9  0x04a845fb in _pthread_body ()
#10 0x04a84485 in _pthread_start ()

Thread 9, Queue : (null)
#0  0x04ac2046 in __workq_kernreturn ()
#1  0x04a85dcf in _pthread_wqthread ()

Thread 10, Queue : (null)
#0  0x04ac2046 in __workq_kernreturn ()
#1  0x04a85dcf in _pthread_wqthread ()

Thread 11, Queue : (null)
#0  0x04ac2046 in __workq_kernreturn ()
#1  0x04a85dcf in _pthread_wqthread ()

Thread 12, Queue : (null)
#0  0x04ac2046 in __workq_kernreturn ()
#1  0x04a85dcf in _pthread_wqthread ()

Thread 13, Queue : (null)
#0  0x04ac2046 in __workq_kernreturn ()
#1  0x04a85dcf in _pthread_wqthread ()

Thread 14, Queue : (null)
#0  0x04ac2046 in __workq_kernreturn ()
#1  0x04a85dcf in _pthread_wqthread ()

Thread 15 AFNetworking, Queue : (null)
#0  0x04abcf7a in mach_msg_trap ()
#1  0x04abc16c in mach_msg ()
#2  0x042abe49 in __CFRunLoopServiceMachPort ()
#3  0x042b13b1 in __CFRunLoopRun ()
#4  0x042b0ac3 in CFRunLoopRunSpecific ()
#5  0x042b08db in CFRunLoopRunInMode ()
#6  0x0303c9c5 in -[NSRunLoop(NSRunLoop) runMode:beforeDate:] ()
#7  0x02fd88d1 in -[NSRunLoop(NSRunLoop) run] ()
#8  0x00087fbb in +[AFURLConnectionOperation networkRequestThreadEntryPoint:] at /Users/olivier/Documents/elektra/src/elektra/third_party/AFNetworking-1.3.3/AFNetworking/AFURLConnectionOperation.m:184
#9  0x03037597 in -[NSThread main] ()
#10 0x030374f6 in __NSThread__main__ ()
#11 0x04a845fb in _pthread_body ()
#12 0x04a84485 in _pthread_start ()

Thread 16 com.apple.CFSocket.private, Queue : (null)
#0  0x04ac1ace in select$DARWIN_EXTSN ()
#1  0x042ef3eb in __CFSocketManager ()
#2  0x04a845fb in _pthread_body ()
#3  0x04a84485 in _pthread_start ()

Thread 17, Queue : (null)
#0  0x04ac2046 in __workq_kernreturn ()
#1  0x04a85dcf in _pthread_wqthread ()

Thread 18, Queue : (null)
#0  0x04ac2046 in __workq_kernreturn ()
#1  0x04a85dcf in _pthread_wqthread ()

Thread 19, Queue : (null)
#0  0x04ac2046 in __workq_kernreturn ()
#1  0x04a85dcf in _pthread_wqthread ()

1 个答案:

答案 0 :(得分:0)

感谢这篇文章:EXC_BAD_ACCESS error thrown in xcode

事实证明,这不是一个死锁,而是一个已被释放然后发出消息的对象。 我虽然僵尸已启用,但它们未启用我的测试目标。一旦我启用了这些,很容易找出问题。