Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Incorrect display node thread affinity when reloading ASCollectionNode #1958

Closed
KRUBERLICK opened this issue Jul 20, 2016 · 11 comments
Closed

Comments

@KRUBERLICK
Copy link

KRUBERLICK commented Jul 20, 2016

I have a crash after trying to reload data in ASCollectionNode.
Here's my setup:
I have a ASTableNodes inside of ASCollectionNode cells. Each table node represents a separate feed list. I have an option to apply a filter to particular feed which must insert a new cell with filtered feed into collection node. When the filter is being reseted the filtered feed cell needs to be deleted.
Sometimes after new cell insertion/deletion the crash occurs.
I've been using collectionNode.view.insertItemsAtIndexPaths: to instantiate a new cell with filtered feed and collectionNode.deleteItemsAtIndexPaths: to remove the filtered feed.
Any ideas or suggestions?
Thanks!

Here's some screens:
image
image

@KRUBERLICK
Copy link
Author

Update: crash occurs in removeFromSupernode method in ASDisplayNode

@maicki
Copy link
Contributor

maicki commented Jul 21, 2016

@KRUBERLICK Hey I would have a couple of question:

  • Which version of ASDK are you on?
  • Did you try master?
  • Do you use Implicit Hierarchy Management in one of the nodes?
  • Could you please post the full stacktracek (bt all) if the crash occurs?
  • Is it reproducible in a short example app?

Thank you very much!

@KRUBERLICK
Copy link
Author

@maicki I'm using ASDK 1.9.80 and implicit hierarchy management on all nodes, so I don't use addSubnode manually. As I said, the crash occurs in after trying to insert/delete item from ASCollectionNode.
Here's the stack:
thread #1: tid = 0x280c1e, 0x0000000182e10fd8 libsystem_kernel.dylibmach_msg_trap + 8, queue = 'com.apple.main-thread'
frame #0: 0x0000000182e10fd8 libsystem_kernel.dylibmach_msg_trap + 8 frame #1: 0x0000000182e10e54 libsystem_kernel.dylibmach_msg + 72
frame #2: 0x0000000183248c60 CoreFoundation__CFRunLoopServiceMachPort + 196 frame #3: 0x0000000183246964 CoreFoundation__CFRunLoopRun + 1032
frame #4: 0x0000000183170c50 CoreFoundationCFRunLoopRunSpecific + 384 frame #5: 0x0000000184a58088 GraphicsServicesGSEventRunModal + 180
frame #6: 0x000000018845a088 UIKitUIApplicationMain + 204 frame #7: 0x0000000100031078 Carawellamain + 144 at AppDelegate.swift:12
frame #8: 0x0000000182d0e8b8 libdyld.dylib`start + 4

thread #2: tid = 0x280c4d, 0x0000000182e2cb48 libsystem_kernel.dylib__workq_kernreturn + 8 frame #0: 0x0000000182e2cb48 libsystem_kernel.dylib__workq_kernreturn + 8
frame #1: 0x0000000182ef5530 libsystem_pthread.dylib_pthread_wqthread + 1284 frame #2: 0x0000000182ef5020 libsystem_pthread.dylibstart_wqthread + 4

thread #3: tid = 0x280c4e, 0x0000000182e11014 libsystem_kernel.dylibsemaphore_wait_trap + 8, queue = 'org.AsyncDisplayKit.ASDataController.editingTransactionQueue :: NSOperation 0x12f7446b0 (QOS: LEGACY)', activity = 'send control actions', 4 messages frame #0: 0x0000000182e11014 libsystem_kernel.dylibsemaphore_wait_trap + 8
frame #1: 0x0000000100d77efc libdispatch.dylib_dispatch_group_wait_slow + 260 frame #2: 0x00000001003731ec AsyncDisplayKit-[ASDataController _layoutNodesFromContexts:ofKind:completion:](self=0x000000012f6749a0, _cmd="_layoutNodesFromContexts:ofKind:completion:", contexts=1 element, kind="_ASDataControllerRowNodeKind", completionBlock=0x000000016e112970) + 2104 at ASDataController.mm:252
frame #3: 0x0000000100371c38 AsyncDisplayKit-[ASDataController batchLayoutNodesFromContexts:ofKind:completion:](self=0x000000012f6749a0, _cmd="batchLayoutNodesFromContexts:ofKind:completion:", contexts=1 element, kind="_ASDataControllerRowNodeKind", completionBlock=0x000000016e112970) + 428 at ASDataController.mm:127 frame #4: 0x00000001003724b8 AsyncDisplayKit-[ASDataController _batchLayoutNodesFromContexts:withAnimationOptions:](self=0x000000012f6749a0, _cmd="_batchLayoutNodesFromContexts:withAnimationOptions:", contexts=1 element, animationOptions=5) + 200 at ASDataController.mm:153
frame #5: 0x000000010037c930 AsyncDisplayKit__64-[ASDataController insertRowsAtIndexPaths:withAnimationOptions:]_block_invoke_3(.block_descriptor=0x000000012f7440a0) + 100 at ASDataController.mm:838 frame #6: 0x0000000183c4c540 FoundationNSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK + 16
frame #7: 0x0000000183b9e870 Foundation-[NSBlockOperation main] + 96 frame #8: 0x0000000183b8ee48 Foundation-[__NSOperationInternal _start:] + 604
frame #9: 0x0000000183c4e934 Foundation__NSOQSchedule_f + 224 frame #10: 0x0000000100d65a3c libdispatch.dylib_dispatch_client_callout + 16
frame #11: 0x0000000100d72554 libdispatch.dylib_dispatch_queue_drain + 1036 frame #12: 0x0000000100d6972c libdispatch.dylib_dispatch_queue_invoke + 464
frame #13: 0x0000000100d7466c libdispatch.dylib_dispatch_root_queue_drain + 760 frame #14: 0x0000000100d74364 libdispatch.dylib_dispatch_worker_thread3 + 132
frame #15: 0x0000000182ef5470 libsystem_pthread.dylib_pthread_wqthread + 1092 frame #16: 0x0000000182ef5020 libsystem_pthread.dylibstart_wqthread + 4

thread #4: tid = 0x280c4f, 0x0000000182e2d4d8 libsystem_kernel.dylibkevent_qos + 8, queue = 'com.apple.libdispatch-manager' frame #0: 0x0000000182e2d4d8 libsystem_kernel.dylibkevent_qos + 8
frame #1: 0x0000000100d7a0fc libdispatch.dylib_dispatch_mgr_invoke + 232 frame #2: 0x0000000100d67cb8 libdispatch.dylib_dispatch_mgr_thread + 52

thread #5: tid = 0x280c50, 0x0000000182e2cb48 libsystem_kernel.dylib__workq_kernreturn + 8 frame #0: 0x0000000182e2cb48 libsystem_kernel.dylib__workq_kernreturn + 8
frame #1: 0x0000000182ef5530 libsystem_pthread.dylib_pthread_wqthread + 1284 frame #2: 0x0000000182ef5020 libsystem_pthread.dylibstart_wqthread + 4

thread #9: tid = 0x280c6c, 0x0000000182e10fd8 libsystem_kernel.dylibmach_msg_trap + 8, name = 'com.apple.NSURLConnectionLoader' frame #0: 0x0000000182e10fd8 libsystem_kernel.dylibmach_msg_trap + 8
frame #1: 0x0000000182e10e54 libsystem_kernel.dylibmach_msg + 72 frame #2: 0x0000000183248c60 CoreFoundationCFRunLoopServiceMachPort + 196
frame #3: 0x0000000183246964 CoreFoundation__CFRunLoopRun + 1032 frame #4: 0x0000000183170c50 CoreFoundationCFRunLoopRunSpecific + 384
frame #5: 0x00000001838f1c68 CFNetwork+[NSURLConnection(Loader) _resourceLoadLoop:] + 412 frame #6: 0x0000000183c67e4c Foundation__NSThread__start
+ 1000
frame #7: 0x0000000182ef7b28 libsystem_pthread.dylib_pthread_body + 156 frame #8: 0x0000000182ef7a8c libsystem_pthread.dylib_pthread_start + 156
frame #9: 0x0000000182ef5028 libsystem_pthread.dylib`thread_start + 4

thread #10: tid = 0x280c70, 0x0000000182e2c344 libsystem_kernel.dylib__select + 8, name = 'com.apple.CFSocket.private' frame #0: 0x0000000182e2c344 libsystem_kernel.dylib__select + 8
frame #1: 0x000000018324f1c8 CoreFoundation__CFSocketManager + 648 frame #2: 0x0000000182ef7b28 libsystem_pthread.dylib_pthread_body + 156
frame #3: 0x0000000182ef7a8c libsystem_pthread.dylib_pthread_start + 156 frame #4: 0x0000000182ef5028 libsystem_pthread.dylibthread_start + 4

thread #11: tid = 0x280c71, 0x0000000182e2cb48 libsystem_kernel.dylib__workq_kernreturn + 8 frame #0: 0x0000000182e2cb48 libsystem_kernel.dylib__workq_kernreturn + 8
frame #1: 0x0000000182ef5530 libsystem_pthread.dylib_pthread_wqthread + 1284 frame #2: 0x0000000182ef5020 libsystem_pthread.dylibstart_wqthread + 4

thread #12: tid = 0x280c72, 0x0000000182e2cb48 libsystem_kernel.dylib__workq_kernreturn + 8 frame #0: 0x0000000182e2cb48 libsystem_kernel.dylib__workq_kernreturn + 8
frame #1: 0x0000000182ef5530 libsystem_pthread.dylib_pthread_wqthread + 1284 frame #2: 0x0000000182ef5020 libsystem_pthread.dylibstart_wqthread + 4

thread #13: tid = 0x280c73, 0x0000000182e2cb48 libsystem_kernel.dylib__workq_kernreturn + 8 frame #0: 0x0000000182e2cb48 libsystem_kernel.dylib__workq_kernreturn + 8
frame #1: 0x0000000182ef5530 libsystem_pthread.dylib_pthread_wqthread + 1284 frame #2: 0x0000000182ef5020 libsystem_pthread.dylibstart_wqthread + 4

  • thread [ASDisplayNode] Support .transform and .subnodeTransform in point conversion methods #8: tid = 0x280c8d, 0x0000000182e2c11c libsystem_kernel.dylib__pthread_kill + 8, queue = 'com.apple.root.default-qos', activity = 'send control actions', stop reason = signal SIGABRT frame #0: 0x0000000182e2c11c libsystem_kernel.dylib__pthread_kill + 8
    frame Use correct format identifiers for logs on 64 bit systems. #1: 0x0000000182ef8ef8 libsystem_pthread.dylibpthread_kill + 112 frame #2: 0x0000000182d9ddac libsystem_c.dylibabort + 140
    frame Inconsistent boolean property naming #3: 0x00000001828d13f4 libc++abi.dylibabort_message + 132 frame #4: 0x00000001828ede98 libc++abi.dylibdefault_terminate_handler() + 304
    frame Unexport _ASAsyncTransactionContainer+Private.h in podspec, project file #5: 0x00000001828f8248 libobjc.A.dylib_objc_terminate() + 124 frame #6: 0x00000001828f8248 libobjc.A.dylib_objc_terminate() + 124
    frame Caching code seems entirely unused #7: 0x00000001828eaf44 libc++abi.dylibstd::__terminate(void (*)()) + 16 frame #8: 0x00000001828ea85c libc++abi.dylib__cxa_throw + 136
    frame Add umbrella header #9: 0x00000001828f8094 libobjc.A.dylibobjc_exception_throw + 332 frame #10: 0x0000000183292c80 CoreFoundation+[NSException raise:format:arguments:] + 108
    frame [ASDisplayNode] Support UIMenuController #11: 0x0000000183c18154 Foundation`-[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 112
    • frame ASDisplayNode documentation #12: 0x00000001003aa3bc AsyncDisplayKit-[ASDisplayNode removeFromSupernode](self=0x000000012f76ba50, _cmd="removeFromSupernode") + 284 at ASDisplayNode.mm:1511 frame #13: 0x00000001003a634c AsyncDisplayKit-[ASDisplayNode _insertSubnode:atSubnodeIndex:sublayerIndex:andRemoveSubnode:](self=0x00000001308329d0, _cmd="_insertSubnode:atSubnodeIndex:sublayerIndex:andRemoveSubnode:", subnode=0x000000012f76ba50, subnodeIndex=0, sublayerIndex=9223372036854775807, oldSubnode=0x0000000000000000) + 288 at ASDisplayNode.mm:1289
      frame Updated README #14: 0x00000001003a95c0 AsyncDisplayKit-[ASDisplayNode insertSubnode:atIndex:](self=0x00000001308329d0, _cmd="insertSubnode:atIndex:", subnode=0x000000012f76ba50, idx=0) + 1440 at ASDisplayNode.mm:1466 frame #15: 0x00000001003e4ae0 AsyncDisplayKit-[ASLayoutTransition applySubnodeInsertions](self=0x0000000130809260, _cmd="applySubnodeInsertions") + 320 at ASLayoutTransition.mm:49
      frame userInteractionEnabled defaults to NO #16: 0x00000001003b2224 AsyncDisplayKit-[ASDisplayNode applyLayout:layoutContext:](self=0x00000001308329d0, _cmd="applyLayout:layoutContext:", layout=0x000000012f54eda0, layoutContext=0x0000000130809260) + 1380 at ASDisplayNode.mm:2371 frame #17: 0x000000010039f864 AsyncDisplayKit-[ASDisplayNode measureWithSizeRange:](self=0x00000001308329d0, _cmd="measureWithSizeRange:", constrainedSize=%28min = %28width = 414, height = 622%29, max = %28width = 414, height = 622%29%29) + 708 at ASDisplayNode.mm:629
      frame Fix unit tests in ASTextNodeWordKernerTests #18: 0x0000000100372234 AsyncDisplayKit-[ASDataController _layoutNode:withConstrainedSize:](self=0x000000012f6749a0, _cmd="_layoutNode:withConstrainedSize:", node=0x00000001308329d0, constrainedSize=(min = (width = 414, height = 622), max = (width = 414, height = 622))) + 108 at ASDataController.mm:144 frame #19: 0x0000000100372884 AsyncDisplayKit-[ASDataController _layoutNodes:fromContexts:atIndexesOfRange:ofKind:](self=0x000000012f6749a0, _cmd="_layoutNodes:fromContexts:atIndexesOfRange:ofKind:", nodes=1 element, contexts=1 element, range=location=0, length=1, kind="_ASDataControllerRowNodeKind") + 528 at ASDataController.mm:176
      frame Fix incorrect -display and -drawInContext: references in ASDisplayNode(Subclasses) #20: 0x0000000100374158 AsyncDisplayKit__63-[ASDataController _layoutNodesFromContexts:ofKind:completion:]_block_invoke.111(.block_descriptor=<unavailable>) + 140 at ASDataController.mm:247 frame #21: 0x0000000100d65a7c libdispatch.dylib_dispatch_call_block_and_release + 24
      frame Added Travis configuration and badge #22: 0x0000000100d65a3c libdispatch.dylib_dispatch_client_callout + 16 frame #23: 0x0000000100d74c9c libdispatch.dylib_dispatch_root_queue_drain + 2344
      frame Added Travis configuration #24: 0x0000000100d74364 libdispatch.dylib_dispatch_worker_thread3 + 132 frame #25: 0x0000000182ef5470 libsystem_pthread.dylib_pthread_wqthread + 1092
      frame Annotate -didLoad with an attribute (if supported) that will flag missing didLoad calls #26: 0x0000000182ef5020 libsystem_pthread.dylibstart_wqthread + 4

@KRUBERLICK
Copy link
Author

image

@KRUBERLICK
Copy link
Author

@maicki when I use the empty ASCellNodes instead of custom nodes with ASTableNode feeds everything work OK - item insertion/deletion. So I guess the problem is hiding somewhere in the ASTableNodes...

@KRUBERLICK
Copy link
Author

Update: switching to collectionView:nodeForItemAtIndexPath:/tableView:nodeForRowAtIndexPath: instead of nodeBlockForIndexPath kinda fixes this issue.
But anyway, I don't know why :)

@maicki
Copy link
Contributor

maicki commented Jul 21, 2016

@KRUBERLICK Can you try updating to 1.9.81 or master. This issue should be fixed in there.

@KRUBERLICK
Copy link
Author

@maicki just tried 1.9.81 and everything seems to work fine!

@maicki
Copy link
Contributor

maicki commented Jul 21, 2016

@KRUBERLICK Great to hear :) Just to clarify you changed back to the nodeBlock based data source api's right?

@KRUBERLICK
Copy link
Author

@maicki yes, tableView:nodeBlockForRowAtIndexPath: and collectionView:nodeBlockForItemAtIndexPath: are working ok.
I think that it was some bug when allocating nodes off the main thread or something like this...
But anyway, it works! :)

@maicki
Copy link
Contributor

maicki commented Jul 21, 2016

@KRUBERLICK I will close this issue for now. Please reopen in case you think it's not fixed. Thank you!

@maicki maicki closed this as completed Jul 21, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants