Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around KVC Crasher in CMObject -description method #82

Merged
merged 2 commits into from Sep 27, 2016

Conversation

apbendi
Copy link
Contributor

@apbendi apbendi commented Sep 26, 2016

NOTE: Merge after #80

A customer reports a low but non-negligible crash rate from
CMObject's -description method. The method throws a
NSUndefinedKeyException in rare circumstances, which we can not
reproduce. The key being called is one observed dynamically by
the MAObjCRuntime library. This is the most conservative fix:
in this method only, we call a "safe" version of valueForKey: which
wraps the call in a @try-@catch block.

A more aggressive fix would have been to override -valueForUndefinedKey:
on CMObject, but given the runtime trickery used throughout the app,
I can't feel 100% confident there would be no other side effects in
doing so. There have been other places in the SDK where @try-@catch had
been used for actual control flow.

The ideal fix would be to track down why the RT lib is returning a
property name that subsequently results in an undefined key exception.
Given the low incedence and the fact its coming from a non-critical
code path, investing that time seems overkill for now.

A customer reports a low but non-negligible crash rate from
CMObject's -description method. The method throws a
NSUndefinedKeyException in rare circumstances, which we can not
reproduce. The key being called is one observed dynamically by
the MAObjCRuntime library. This is the most conservative fix:
in this method only, we call a "safe" version of valueForKey: which
wraps the call in a @try-@catch block.

A more aggressive fix would have been to override -valueForUndefinedKey:
on CMObject, but given the runtime trickery used throughout the app,
I can't feel 100% confident there would be no other side effects in
doing so. There have been other places in the SDK where @try-@catch had
been used for actual control flow.

The *ideal* fix would be to track down why the RT lib is returning a
property  name that subsequently results in an undefined key exception.
Given the low incedence and the fact its coming from a non-critical
code path, investing that time seems overkill for now.
@marcweil marcweil merged commit 9a64f11 into cloudmine:develop Sep 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants