{"action":"opened","issue":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/380","labels_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/380/labels{/name}","comments_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/380/comments","events_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/380/events","html_url":"https://github.com/facebook/AsyncDisplayKit/issues/380","id":61419286,"number":380,"title":"Race condition between reloadData and ASImageView.setImage","user":{"login":"eanagel","id":842898,"avatar_url":"https://avatars.githubusercontent.com/u/842898?v=3","gravatar_id":"","url":"https://api.github.com/users/eanagel","html_url":"https://github.com/eanagel","followers_url":"https://api.github.com/users/eanagel/followers","following_url":"https://api.github.com/users/eanagel/following{/other_user}","gists_url":"https://api.github.com/users/eanagel/gists{/gist_id}","starred_url":"https://api.github.com/users/eanagel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eanagel/subscriptions","organizations_url":"https://api.github.com/users/eanagel/orgs","repos_url":"https://api.github.com/users/eanagel/repos","events_url":"https://api.github.com/users/eanagel/events{/privacy}","received_events_url":"https://api.github.com/users/eanagel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-14T05:01:59Z","updated_at":"2015-03-14T05:01:59Z","closed_at":null,"body":"I managed to track down a race condition in the current master build (1278fe2cf08249f9ba8c02927c9da72a4fb27d58.) It is pretty easy for me to reproduce with several runs of my application. The issue appears to happen if a node property is set (in my case `ASImageView`'s `setImage`) while the sizing queue is also measuring the same cell. I would expect the mutex to allow these operations to happen without negative interaction, but in my case we are ending up with a race condition.\r\n\r\nHere is the first stack trace, on the main thread:\r\n\r\n\t#2\t0x0000000104ac5685 in ASDN::Mutex::lock() at .../Headers/Build/AsyncDisplayKit/ASThread.h:124\r\n\t#3\t0x0000000104ac5653 in ASDN::Locker<ASDN::Mutex>::Locker(ASDN::Mutex&) at .../Headers/Build/AsyncDisplayKit/ASThread.h:69\r\n\t#4\t0x0000000104ac54ad in ASDN::Locker<ASDN::Mutex>::Locker(ASDN::Mutex&) at .../Headers/Build/AsyncDisplayKit/ASThread.h:70\r\n\t#5\t0x0000000104ab2b7c in -[ASDisplayNode shouldRasterizeDescendants] at .../AsyncDisplayKit/AsyncDisplayKit/ASDisplayNode.mm:520\r\n\t#6\t0x0000000104aafbc9 in -[ASDisplayNode __rasterizedContainerNode] at .../AsyncDisplayKit/AsyncDisplayKit/ASDisplayNode.mm:249\r\n\t#7\t0x0000000104a9dd3b in -[ASDisplayNode(UIViewBridge) setNeedsDisplay] at .../AsyncDisplayKit/AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm:161\r\n\t#8\t0x0000000104adb7b9 in __24-[ASImageNode setImage:]_block_invoke at .../AsyncDisplayKit/AsyncDisplayKit/ASImageNode.mm:116\r\n\t#9\t0x0000000104aad9e0 in ASDisplayNodePerformBlockOnMainThread(void () block_pointer) at .../AsyncDisplayKit/AsyncDisplayKit/ASDisplayNode.mm:76\r\n\t#10\t0x0000000104adb6d5 in -[ASImageNode setImage:] at .../AsyncDisplayKit/AsyncDisplayKit/ASImageNode.mm:114\r\n\r\nMeanwhile, on a background thread we see this. (Which was dispatched from the main thread originally.)\r\n\r\n\r\n\t#2\t0x0000000104ac5685 in ASDN::Mutex::lock() at .../Headers/Build/AsyncDisplayKit/ASThread.h:124\r\n\t#3\t0x0000000104ac5653 in ASDN::Locker<ASDN::Mutex>::Locker(ASDN::Mutex&) at .../Headers/Build/AsyncDisplayKit/ASThread.h:69\r\n\t#4\t0x0000000104ac54ad in ASDN::Locker<ASDN::Mutex>::Locker(ASDN::Mutex&) at .../Headers/Build/AsyncDisplayKit/ASThread.h:70\r\n\t#5\t0x0000000104adb544 in -[ASImageNode calculateSizeThatFits:] at .../AsyncDisplayKit/AsyncDisplayKit/ASImageNode.mm:102\r\n\t#6\t0x0000000104ab1f68 in -[ASDisplayNode __measure:] at .../AsyncDisplayKit/AsyncDisplayKit/ASDisplayNode.mm:456\r\n\t#7\t0x0000000104ab1c6f in -[ASDisplayNode measure:] at .../AsyncDisplayKit/AsyncDisplayKit/ASDisplayNode.mm:441\r\n\t#8\t0x0000000104886e9a in -[StackedLayoutNode calculateSizeThatFits:] at /Users/enagel/Projects/Yahoo/Iris/beamit-ios/app/Iris/ViewControllers/Conversation/Nodes/Shared/StackedLayoutNode.mm:54\r\n\t#9\t0x0000000104ab1f68 in -[ASDisplayNode __measure:] at .../AsyncDisplayKit/AsyncDisplayKit/ASDisplayNode.mm:456\r\n\t#10\t0x0000000104ab1c6f in -[ASDisplayNode measure:] at .../AsyncDisplayKit/AsyncDisplayKit/ASDisplayNode.mm:441\r\n\t#11\t0x0000000104886e9a in -[StackedLayoutNode calculateSizeThatFits:] at /Users/enagel/Projects/Yahoo/Iris/beamit-ios/app/Iris/ViewControllers/Conversation/Nodes/Shared/StackedLayoutNode.mm:54\r\n\t#12\t0x0000000104ab1f68 in -[ASDisplayNode __measure:] at .../AsyncDisplayKit/AsyncDisplayKit/ASDisplayNode.mm:456\r\n\t#13\t0x0000000104ab1c6f in -[ASDisplayNode measure:] at .../AsyncDisplayKit/AsyncDisplayKit/ASDisplayNode.mm:441\r\n\t#14\t0x0000000104737c23 in -[ActivityConversationNode calculateSizeThatFits:] at /Users/enagel/Projects/Yahoo/Iris/beamit-ios/app/Iris/ViewControllers/Conversation/Nodes/ActivityConversationNode.mm:157\r\n\t#15\t0x0000000104ab1f68 in -[ASDisplayNode __measure:] at .../AsyncDisplayKit/AsyncDisplayKit/ASDisplayNode.mm:456\r\n\t#16\t0x0000000104ab1c6f in -[ASDisplayNode measure:] at .../AsyncDisplayKit/AsyncDisplayKit/ASDisplayNode.mm:441\r\n\t#17\t0x000000010497b133 in -[ConversationCellNode calculateSizeThatFits:] at /Users/enagel/Projects/Yahoo/Iris/beamit-ios/app/Iris/ViewControllers/Conversation/Nodes/ConversationCellNode.mm:51\r\n\t#18\t0x0000000104ab1f68 in -[ASDisplayNode __measure:] at .../AsyncDisplayKit/AsyncDisplayKit/ASDisplayNode.mm:456\r\n\t#19\t0x0000000104ab1c6f in -[ASDisplayNode measure:] at .../AsyncDisplayKit/AsyncDisplayKit/ASDisplayNode.mm:441\r\n\t#20\t0x0000000104a9147c in __66-[ASDataController _insertNodes:atIndexPaths:withAnimationOption:]_block_invoke_2 at .../AsyncDisplayKit/AsyncDisplayKit/Details/ASDataController.mm:340\r\n\t#21\t0x000000010a554156 in __53-[__NSArrayI enumerateObjectsWithOptions:usingBlock:]_block_invoke ()\r\n\t#22\t0x000000010a55408c in -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] ()\r\n\t#23\t0x0000000104a912a9 in __66-[ASDataController _insertNodes:atIndexPaths:withAnimationOption:]_block_invoke189 at .../AsyncDisplayKit/AsyncDisplayKit/Details/ASDataController.mm:338\r\n\t#24\t0x000000010ac2cba6 in _dispatch_call_block_and_release ()\r\n\t#25\t0x000000010ac4a7f4 in _dispatch_client_callout ()\r\n\t#26\t0x000000010ac3515d in _dispatch_root_queue_drain ()\r\n\t#27\t0x000000010ac36612 in _dispatch_worker_thread2 ()\r\n\t#28\t0x000000010afe2ef8 in _pthread_wqthread ()\r\n\t#29\t0x000000010afe5fb9 in start_wqthread ()\r\n\tEnqueued from com.facebook.AsyncDisplayKit.ASDataController.sizingQueue (Thread 5)Queue : com.facebook.AsyncDisplayKit.ASDataController.sizingQueue (serial)\r\n\t#0\t0x000000010ac30c39 in dispatch_group_async ()\r\n\t#1\t0x0000000104a90aab in -[ASDataController _insertNodes:atIndexPaths:withAnimationOption:] at .../AsyncDisplayKit/AsyncDisplayKit/Details/ASDataController.mm:337\r\n\t#2\t0x0000000104a92223 in -[ASDataController _batchInsertNodes:atIndexPaths:withAnimationOptions:] at .../AsyncDisplayKit/AsyncDisplayKit/Details/ASDataController.mm:374\r\n\t#3\t0x0000000104a95448 in __50-[ASDataController reloadDataWithAnimationOption:]_block_invoke_2 at .../AsyncDisplayKit/AsyncDisplayKit/Details/ASDataController.mm:480\r\n\t#4\t0x000000010ac2cba6 in _dispatch_call_block_and_release ()\r\n\t#5\t0x000000010ac4a7f4 in _dispatch_client_callout ()\r\n\t#6\t0x000000010ac32b22 in _dispatch_queue_drain ()\r\n\t#7\t0x000000010ac32432 in _dispatch_queue_invoke ()\r\n\t#8\t0x000000010ac34fc1 in _dispatch_root_queue_drain ()\r\n\t#9\t0x000000010ac36612 in _dispatch_worker_thread2 ()\r\n\t#10\t0x000000010afe2ef8 in _pthread_wqthread ()\r\n\t#11\t0x000000010afe5fb9 in start_wqthread ()\r\n\tEnqueued from com.apple.main-thread (Thread 1)Queue : com.apple.main-thread (serial)\r\n\t#0\t0x000000010ac364ba in _dispatch_barrier_async_f_slow ()\r\n\t#1\t0x0000000104a95221 in __50-[ASDataController reloadDataWithAnimationOption:]_block_invoke at .../AsyncDisplayKit/AsyncDisplayKit/Details/ASDataController.mm:459\r\n\t#2\t0x0000000104a8b11a in -[ASDataController performDataFetchingWithBlock:] at .../AsyncDisplayKit/AsyncDisplayKit/Details/ASDataController.mm:149\r\n\t#3\t0x0000000104a94c47 in -[ASDataController reloadDataWithAnimationOption:] at .../AsyncDisplayKit/AsyncDisplayKit/Details/ASDataController.mm:442\r\n\t#4\t0x0000000104af38b9 in -[ASTableView reloadData] at .../AsyncDisplayKit/AsyncDisplayKit/ASTableView.mm:214\r\n\r\n"}}