objc_msgSend() crash on notification on Yosemite

Intermittent crashes happened on Yosemite, around sending notifications.

After retesting on all OSs from 10.10.5 to 10.13.3 - unable to replicate.

Also tried with different users and (two) machines.

The app has always been written in swift, but it was upgraded to Swift 4 since the last release.


Has anyone seen anything similar on Yosemite only?


These are the crash reports:

1)

Crashed Thread:        0  Dispatch queue: com.apple.main-thread


Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:      KERN_INVALID_ADDRESS at 0x0000289b8942bec0


VM Regions Near 0x289b8942bec0:
    MALLOC_LARGE          000000010da36000-000000010da6c000 [  216K] rw-/rwx SM=ZER
-->
    MALLOC_NANO            0000600000000000-0000600000200000 [ 2048K] rw-/rwx SM=PRV


Application Specific Information:
objc_msgSend() selector name: disallowNavigation:
Performing @selector(doubleClick:) from sender "AppName".TableView 0x7f895061a790


Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0  libobjc.A.dylib              0x00007fff974b40dd objc_msgSend + 29
1  com.apple.CoreFoundation      0x00007fff8f247444 _CFXNotificationPost + 3140
2  com.apple.Foundation          0x00007fff8d55f881 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
3  "bundle id"              0x000000010059ed3c 0x10055d000 + 269628
4  "bundle id"              0x000000010059f3e2 0x10055d000 + 271330
5  com.apple.CoreFoundation      0x00007fff8f2a79ff -[NSSet makeObjectsPerformSelector:] + 223
6  com.apple.AppKit              0x00007fff9b51c00b -[NSIBObjectData nibInstantiateWithOwner:options:topLevelObjects:] + 1166
7  com.apple.AppKit              0x00007fff9b6f690e -[NSNib _instantiateNibWithExternalNameTable:options:] + 677
8  com.apple.AppKit              0x00007fff9b6f655e -[NSNib _instantiateWithOwner:options:topLevelObjects:] + 143
9  com.apple.AppKit              0x00007fff9b6f5857 -[NSViewController loadView] + 272
10  com.apple.AppKit              0x00007fff9b674e13 -[NSViewController _loadViewIfRequired] + 75
11  com.apple.AppKit              0x00007fff9b674d7d -[NSViewController view] + 30
12  com.apple.AppKit              0x00007fff9bccb943 +[NSWindow windowWithContentViewController:] + 38
13  com.apple.AppKit              0x00007fff9bb4c726 -[NSViewControllerSheetTransition animatePresentationOfViewController:fromViewController:] + 276
14  com.apple.AppKit              0x00007fff9ba15319 -[NSViewController presentViewControllerAsSheet:] + 95
15  com.apple.AppKit              0x00007fff9ba155d5 -[NSViewController performSegueWithIdentifier:sender:] + 256
16  "bundle id"              0x000000010068506e 0x10055d000 + 1212526
17  "bundle id"              0x000000010068524f 0x10055d000 + 1213007
18  libsystem_trace.dylib        0x00007fff90f63cd7 _os_activity_initiate + 75
19  com.apple.AppKit              0x00007fff9b744eb1 -[NSApplication sendAction:to:from:] + 452
20  com.apple.AppKit              0x00007fff9b75a946 -[NSControl sendAction:to:] + 86
21  com.apple.AppKit              0x00007fff9b80aef3 -[NSTableView _sendAction:to:row:column:] + 90
22  com.apple.AppKit              0x00007fff9b809527 -[NSTableView mouseDown:] + 6502
23  com.apple.AppKit              0x00007fff9bcc12dc -[NSWindow _reallySendEvent:isDelayedEvent:] + 14125
24  com.apple.AppKit              0x00007fff9b650c86 -[NSWindow sendEvent:] + 470
25  com.apple.AppKit              0x00007fff9b64d212 -[NSApplication sendEvent:] + 2504
26  com.apple.AppKit              0x00007fff9b576b68 -[NSApplication run] + 711
27  com.apple.AppKit              0x00007fff9b4f3244 NSApplicationMain + 1832
28  "bundle id"              0x0000000100568279 0x10055d000 + 45689
29  libdyld.dylib                0x00007fff8f6d45c9 start + 1



2)

Crashed Thread:        0  Dispatch queue: com.apple.main-thread


Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:      KERN_INVALID_ADDRESS at 0x0000000000000018


VM Regions Near 0x18:
-->
    __TEXT                0000000102700000-0000000102924000 [ 2192K] r-x/rwx SM=COW  /Applications/"AppName".app/Contents/MacOS/"AppName"


Application Specific Information:
objc_msgSend() selector name: importingNoNavigation:




Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0  libobjc.A.dylib              0x00007fff974b40dd objc_msgSend + 29
1  com.apple.CoreFoundation      0x00007fff8f247444 _CFXNotificationPost + 3140
2  com.apple.Foundation          0x00007fff8d55f881 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
3  "bundle id"              0x00000001027c5a87 0x102700000 + 809607
4  "bundle id"              0x00000001027af141 0x102700000 + 717121
5  "bundle id"              0x00000001027afc5c 0x102700000 + 719964
6  com.apple.CoreFoundation      0x00007fff8f35745c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
7  com.apple.CoreFoundation      0x00007fff8f247444 _CFXNotificationPost + 3140
8  com.apple.Foundation          0x00007fff8d55f881 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
9  "bundle id"              0x00000001027e3d22 0x102700000 + 933154
10  libsystem_trace.dylib        0x00007fff90f63cd7 _os_activity_initiate + 75
11  com.apple.AppKit              0x00007fff9b744eb1 -[NSApplication sendAction:to:from:] + 452
12  com.apple.AppKit              0x00007fff9b744c4e -[NSMenuItem _corePerformAction] + 382
13  com.apple.AppKit              0x00007fff9b74497c -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 114
14  libsystem_trace.dylib        0x00007fff90f63cd7 _os_activity_initiate + 75
15  com.apple.AppKit              0x00007fff9b80bb00 -[NSMenu performActionForItemAtIndex:] + 131
16  com.apple.AppKit              0x00007fff9b80ba66 -[NSMenu _internalPerformActionForItemAtIndex:] + 35
17  com.apple.AppKit              0x00007fff9b80b8b2 -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 107
18  com.apple.AppKit              0x00007fff9b72cd6b NSSLMMenuEventHandler + 724
19  com.apple.HIToolbox          0x00007fff9b136b6c DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1260
20  com.apple.HIToolbox          0x00007fff9b135fae SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 386
21  com.apple.HIToolbox          0x00007fff9b14bcb6 SendEventToEventTarget + 40
22  com.apple.HIToolbox          0x00007fff9b185f45 SendHICommandEvent(unsigned int, HICommand const*, unsigned int, unsigned int, unsigned char, void const*, OpaqueEventTargetRef*, OpaqueEventTargetRef*, OpaqueEventRef**) + 428
23  com.apple.HIToolbox          0x00007fff9b1c3b8d SendMenuCommandWithContextAndModifiers + 59
24  com.apple.HIToolbox          0x00007fff9b1c3b30 SendMenuItemSelectedEvent + 188
25  com.apple.HIToolbox          0x00007fff9b1c3a09 FinishMenuSelection(SelectionData*, MenuResult*, MenuResult*) + 96
26  com.apple.HIToolbox          0x00007fff9b1c4481 MenuSelectCore(MenuData*, Point, double, unsigned int, OpaqueMenuRef**, unsigned short*) + 702
27  com.apple.HIToolbox          0x00007fff9b1c40fe _HandleMenuSelection2 + 446
28  com.apple.AppKit              0x00007fff9b64ace0 _NSHandleCarbonMenuEvent + 277
29  com.apple.AppKit              0x00007fff9b581bfd _DPSNextEvent + 1828
30  com.apple.AppKit              0x00007fff9b580e58 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346
31  com.apple.AppKit              0x00007fff9b576af3 -[NSApplication run] + 594
32  com.apple.AppKit              0x00007fff9b4f3244 NSApplicationMain + 1832
33  "bundle id"                    0x000000010270b279 0x102700000 + 45689
34  libdyld.dylib                0x00007fff8f6d45c9 start + 1


3.

Crashed Thread:        0  Dispatch queue: com.apple.main-thread


Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:      0x0000000000000000, 0x0000000000000000


Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI disallowNavigation:]: unrecognized selector sent to instance 0x6000002287e0'
abort() called
terminating with uncaught exception of type NSException


Application Specific Backtrace 1:
0  CoreFoundation                      0x00007fff8f39b03c __exceptionPreprocess + 172
1  libobjc.A.dylib                    0x00007fff974c176e objc_exception_throw + 43
2  CoreFoundation                      0x00007fff8f39e0ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3  CoreFoundation                      0x00007fff8f2e3d44 ___forwarding___ + 1028
4  CoreFoundation                      0x00007fff8f2e38b8 _CF_forwarding_prep_0 + 120
5  CoreFoundation                      0x00007fff8f35745c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
6  CoreFoundation                      0x00007fff8f247444 _CFXNotificationPost + 3140
7  Foundation                          0x00007fff8d55f881 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
8  "AppName"                                0x00000001019c5d3c "AppName" + 269628
9  "AppName"                                0x00000001019c63e2 "AppName" + 271330
10  CoreFoundation                      0x00007fff8f2a79ff -[NSSet makeObjectsPerformSelector:] + 223
11  AppKit                              0x00007fff9b51c00b -[NSIBObjectData nibInstantiateWithOwner:options:topLevelObjects:] + 1166
12  AppKit                              0x00007fff9b6f690e -[NSNib _instantiateNibWithExternalNameTable:options:] + 677
13  AppKit                              0x00007fff9b6f655e -[NSNib _instantiateWithOwner:options:topLevelObjects:] + 143
14  AppKit                              0x00007fff9b6f5857 -[NSViewController loadView] + 272
15  AppKit                              0x00007fff9b674e13 -[NSViewController _loadViewIfRequired] + 75
16  AppKit                              0x00007fff9b674d7d -[NSViewController view] + 30
17  AppKit                              0x00007fff9bccb943 +[NSWindow windowWithContentViewController:] + 38
18  AppKit                              0x00007fff9bb4c726 -[NSViewControllerSheetTransition animatePresentationOfViewController:fromViewController:] + 276
19  AppKit                              0x00007fff9ba15319 -[NSViewController presentViewControllerAsSheet:] + 95
20  AppKit                              0x00007fff9ba155d5 -[NSViewController performSegueWithIdentifier:sender:] + 256
21  "AppName"                                0x0000000101ac6f4f "AppName" + 1322831
22  "AppName"                                0x0000000101aebd2a "AppName" + 1473834
23  XXUtilityKit                    0x0000000101d65499 _T0Ix_IyB_TR + 41
24  libdispatch.dylib                  0x00007fff8e610700 _dispatch_call_block_and_release + 12
25  libdispatch.dylib                  0x00007fff8e60ce73 _dispatch_client_callout + 8
26  libdispatch.dylib                  0x00007fff8e61e6a0 _dispatch_after_timer_callback + 77
27  libdispatch.dylib                  0x00007fff8e60ce73 _dispatch_client_callout + 8
28  libdispatch.dylib                  0x00007fff8e6194e6 _dispatch_source_latch_and_call + 721
29  libdispatch.dylib                  0x00007fff8e61193b _dispatch_source_invoke + 412
30  libdispatch.dylib                  0x00007fff8e61d5aa _dispatch_main_queue_callback_4CF + 416
31  CoreFoundation                      0x00007fff8f2ee319 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
32  CoreFoundation                      0x00007fff8f2a94af __CFRunLoopRun + 2159
33  CoreFoundation                      0x00007fff8f2a89f8 CFRunLoopRunSpecific + 296
34  HIToolbox                          0x00007fff9b16056f RunCurrentEventLoopInMode + 235
35  HIToolbox                          0x00007fff9b1602ea ReceiveNextEventCommon + 431
36  HIToolbox                          0x00007fff9b16012b _BlockUntilNextEventMatchingListInModeWithFilter + 71
37  AppKit                              0x00007fff9b5818ab _DPSNextEvent + 978
38  AppKit                              0x00007fff9b580e58 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346
39  AppKit                              0x00007fff9b576af3 -[NSApplication run] + 594
40  AppKit                              0x00007fff9b4f3244 NSApplicationMain + 1832
41  "AppName"                                0x000000010198f279 "AppName" + 45689
42  libdyld.dylib                      0x00007fff8f6d45c9 start + 1

Replies

Given that this is related to notifications, the first thing to check is that you’re unregistering your notifications properly. In 10.11 we made a change that made this unnecessary, so you might not notice this problem during your day-to-day development. However, this is still a requirement if you deploy to older systems.

You can learn more about this change in the Foundation Release Notes. Search the doc for “NSNotificationCenter” to find the relevant section.

If that doesn’t help then I recommend that you deploy the Standard Memory Debugging Tools. Problems like this are most commonly memory management issues.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thank you very much for your answer. I did my original development on 10.11 so I am most likely not unregistering notifications but I will see to change this for Yosemite