6 Replies
      Latest reply: Jan 25, 2017 2:50 AM by eskimo RSS
      dnorcottrue Level 1 Level 1 (0 points)

        I'm seeing a lot of crashes in my app that all have the same stack trace. They all start at "NSUserActivity(CSSearchableItemAttributeSet) setContentAttributeSet:" and crash with a SIGABRT when trying to get the description of NSData. Unfortunately I haven't been able to reproduce this issue locally.

         

        When a user visits a product in my app (it's an ecommerce app) I add it to the spotlight index by way of NSUserActivity. The NSUserActivlty includes a title, description, thumbnailURL, keywords, and thumbnailData (which is a JPEG).

         

        This code worked fine in iOS 9, but for some reason it is now crashing only for iOS 10.

         

        Has anyone experienced a similar issue? Any workarounds? Does anyone know how to repro the issue reliably?

         

        Here's the stack trace I'm seeing in my crash logs:

         

        0

        libsystem_kernel.dylib

        __pthread_kill + 8

        1 libsystem_pthread.dylib

        pthread_kill + 112

        2 libsystem_c.dylib

        abort + 140

        3 libsystem_malloc.dylib

        _nano_vet_and_size_of_live + 330

        4 libsystem_malloc.dylib

        nano_free + 220

        5 CoreFoundation

        __CFStringChangeSizeMultiple + 2716

        6 CoreFoundation

        __CFStringCheckAndReplace + 736

        7 CoreFoundation

        -[__NSCFString appendString:] + 52

        8 Foundation

        -[NSData(NSData) description] + 524

        9 CoreFoundation

        -[NSDictionary descriptionWithLocale:indent:] + 1028

        10 CoreSpotlight

        -[CSSearchableItemAttributeSet description] + 164

        11 Foundation

        _NS_os_log_callback + 140

        12 libsystem_trace.dylib

        _NSCF2data + 112

        13 libsystem_trace.dylib

        _os_log_encode_arg + 736

        14 libsystem_trace.dylib

        _os_log_impl + 700

        15 UserActivity

        -[UAUserActivity(UAUserActivityCoreSpotlightIndexingSupport) setContentAttributeSet:] + 304

        16 UserActivity

        -[NSUserActivity(CSSearchableItemAttributeSet) setContentAttributeSet:] + 76

        • Re: App crashes randomly when setting Content Attribute Set on NSUserActivity
          eskimo Apple Staff Apple Staff (6,005 points)

          This is a memory management crash; I’m not sure exactly that the issue is, but frames 3 and 4 clearly indicate the memory manager deliberately crashing your app because it’s detected memory corruption.  I suggest you start by running the usual memory management debugging tools over your app (specifically, zombies and the address sanitiser).

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

          • Re: App crashes randomly when setting Content Attribute Set on NSUserActivity
            blankdlh Level 1 Level 1 (0 points)

            We have similar issue on iOS 10. Is it a bug in iOS 10?

            • Re: App crashes randomly when setting Content Attribute Set on NSUserActivity
              dqjk Level 1 Level 1 (0 points)

              i have the same crash,have anyone find a solution?

               

              i have find a solution,i'm not sure if this is a bug of ios 10

              we can user a custom class replace

               

              CSSearchableItemAttributeSet

               

              eg

               

              CSSearchableAttributeSetWithoutDescription

               

              and overide it's description method

               

              @interface CSSearchableAttributeSetWithoutDescription : CSSearchableItemAttributeSet

              @end

              @implementation CSSearchableAttributeSetWithoutDescription

              -(NSString*)description

              {

              return @"CSSearchableAttributeSetWithNoDescription";

              }

              @end

               

              i'm sure the crash is something wrong with the CSSearchableItemAttributeSet's description method,it invoke the attributes(NSDictionary) and the dictionary has a NSData value,the crash is happen in the NSData's description method

              so,we can overide this,and DON'T invoke the NSData's description method

              • Re: App crashes randomly when setting Content Attribute Set on NSUserActivity
                redseadiver Level 1 Level 1 (0 points)

                Seeing the same issue, same stack trace. This became our #1 crash with iOS10  (no reports it happens on other iOS versions). Any update on the radar case?

                 

                libsystem_kernel.dylib 0x000000018e14f014 __pthread_kill + 4

                1

                libsystem_c.dylib 0x000000018e0c3400 abort + 136

                2

                libsystem_malloc.dylib 0x000000018e193a5c nanozone_error + 328

                3

                libsystem_malloc.dylib 0x000000018e194f18 nano_realloc + 372

                4

                libsystem_malloc.dylib 0x000000018e187240 malloc_zone_realloc + 176

                5

                Foundation 0x000000018fbd2628 -[NSString quotedStringRepresentation] + 728

                6

                Foundation 0x000000018fbb244c -[NSString _stringRepresentation] + 372

                7

                CoreFoundation 0x000000018f0a8f0c -[NSDictionary descriptionWithLocale:indent:] + 1024

                8

                CoreSpotlight 0x00000001979cff7c -[CSSearchableItemAttributeSet description] + 160

                9

                Foundation 0x000000018fc74bec _NS_os_log_callback + 136

                10

                libsystem_trace.dylib 0x000000018e23b954 _NSCF2data + 108

                11

                libsystem_trace.dylib 0x000000018e23b564 _os_log_encode_arg + 732

                12

                libsystem_trace.dylib 0x000000018e23a004 _os_log_impl + 788

                13

                UserActivity 0x00000001a07b078c -[UAUserActivity(UAUserActivityCoreSpotlightIndexingSupport) setContentAttributeSet:] + 300

                14

                UserActivity 0x00000001a07b0488 -[NSUserActivity(CSSearchableItemAttributeSet) setContentAttributeSet:] + 72