Debugging crash in notification of observers

I get a lot crash reports with backtraces like the one below. It happens when I set something in user defaults. There are a lot bindings to user default in the app but not necessarily with the key that is set.

I very rarely can reproduce it myself but when I can, it never happens with Zombies enabled. Does anyone has an idea how to debug it.

Thread 0 Crashed:
0   libobjc.A.dylib                      0x00007ff8190edab8 0x7ff8190e1000 + 51896
1   Foundation                           0x00007ff81a1341a1 _NSKVONotifyingOriginalClassForIsa + 20
2   Foundation                           0x00007ff81a1557df _NSKeyValueObservationInfoGetObservances + 262
3   Foundation                           0x00007ff81a14df16 -[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:] + 131
4   AppKit                               0x00007ff81bd25cba -[NSController _notifyObserversForKeyPath:change:] + 187
5   AppKit                               0x00007ff81bd546ca -[NSController observeValueForKeyPath:ofObject:change:context:] + 824
6   Foundation                           0x00007ff81a153c0a NSKeyValueNotifyObserver + 305
7   Foundation                           0x00007ff81a2177b5 NSKeyValueDidChange + 411
8   Foundation                           0x00007ff81a1467bd -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 739
9   Foundation                           0x00007ff81a1554ec -[NSObject(NSKeyValueObservingPrivate) _notifyObserversOfChangeFromValuesForKeys:toValuesForKeys:] + 997
10  CoreFoundation                       0x00007ff8192e03b3 0x7ff81929a000 + 287667
11  CoreFoundation                       0x00007ff81931c235 0x7ff81929a000 + 533045
12  CoreFoundation                       0x00007ff81931c0d8 0x7ff81929a000 + 532696
13  CoreFoundation                       0x00007ff81931bf4e 0x7ff81929a000 + 532302
14  CoreFoundation                       0x00007ff8192e4a3e 0x7ff81929a000 + 305726
15  CoreFoundation                       0x00007ff8192d775b 0x7ff81929a000 + 251739
16  CoreFoundation                       0x00007ff81931bec2 0x7ff81929a000 + 532162
17  CoreFoundation                       0x00007ff8192c8495 0x7ff81929a000 + 189589
18  CoreFoundation                       0x00007ff8192c8d11 0x7ff81929a000 + 191761
19  CoreFoundation                       0x00007ff819423b6f 0x7ff81929a000 + 1612655
20  CoreFoundation                       0x00007ff8193203d0 0x7ff81929a000 + 549840
21  CoreFoundation                       0x00007ff819320344 0x7ff81929a000 + 549700
22  Foundation                           0x00007ff81a190ba0 -[NSUserDefaults(NSUserDefaults) setObject:forKey:] + 72

I get a lot crash reports with backtraces like the one below.

Please post a full crash report. See Posting a Crash Report for advice on how to do that.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

This is a different occurrence but the important part is the same. I have all kind of them. It doesn't really matter where the userdefaults are set.

That doesn’t look like an Apple crash report, which limits what I can do with it )-:

I’m in two minds about this:

  • I don’t have a lot of faith in KVO and Cocoa bindings and this could very well just be a problem with those subsystems.

  • This doesn’t seem to have the tell-tale signs associated with most KVO problems, that is, multiple threads. The crash report has very few threads and none of them are doing anything KVO-ish.

it never happens with Zombies enabled.

What about ASan?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Debugging crash in notification of observers
 
 
Q