Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <NSConcreteHashTable: 0x30220c780> was mutated while being enumerated.'

After the app is put in background for sometime and brought in to foreground and the app crashes each time with a different thread stack entries but all of them states same exception reason.

Answered by DTS Engineer in 824617022

Looking at your first crash report, I see this:

Last Exception Backtrace:
0 CoreFoundation__exceptionPreprocess + 164 (NSException.m:249)
1 libobjc.A.dylibobjc_exception_throw + 88 (objc-exception.mm:356)
2 CoreFoundation__NSFastEnumerationMutationHandler + 116 (NSEnumerator.m:132)
3 Foundation-[NSConcreteHashTable countByEnumeratingWithState:objects:count:] + 124 (NSHashTable.m:579)
4 MyIphoneAppcli_signalHandler + 2452

This suggests a serious problem in your code. Frame 4 indicates that you’re handling a ******, and frame 3 shows that your ****** handler is calling Objective-C. That’s not allowed. ****** handlers are restricted to using a tiny set of system routines, as documented in the sigaction man page.

Is this ****** handler part of a crash reporter? If so, my advice is that you remove it. It’s crashing, which prevents the Apple crash reporter from doing its job. I discuss this issue in detail in Implementing Your Own Crash Reporter.

If this ****** handler isn’t part of a crash reporter, please reply back with more info about what it’s supposed to do. ****** handlers are tricky to get right, and only useful in a very limited set of circumstances.

Share and Enjoy

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

Looking at your first crash report, I see this:

Last Exception Backtrace:
0 CoreFoundation__exceptionPreprocess + 164 (NSException.m:249)
1 libobjc.A.dylibobjc_exception_throw + 88 (objc-exception.mm:356)
2 CoreFoundation__NSFastEnumerationMutationHandler + 116 (NSEnumerator.m:132)
3 Foundation-[NSConcreteHashTable countByEnumeratingWithState:objects:count:] + 124 (NSHashTable.m:579)
4 MyIphoneAppcli_signalHandler + 2452

This suggests a serious problem in your code. Frame 4 indicates that you’re handling a ******, and frame 3 shows that your ****** handler is calling Objective-C. That’s not allowed. ****** handlers are restricted to using a tiny set of system routines, as documented in the sigaction man page.

Is this ****** handler part of a crash reporter? If so, my advice is that you remove it. It’s crashing, which prevents the Apple crash reporter from doing its job. I discuss this issue in detail in Implementing Your Own Crash Reporter.

If this ****** handler isn’t part of a crash reporter, please reply back with more info about what it’s supposed to do. ****** handlers are tricky to get right, and only useful in a very limited set of circumstances.

Share and Enjoy

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

To answer your questions -

Is this ****** handler part of a crash reporter - We don't have and crash reporters in our code.

If this ****** handler isn’t part of a crash reporter? - we don't have any ****** handlers in our code

We don't have any crash reporters or explicit ****** handling code included in our code.

We don't really have any idea about the function represented in frame 4 cli_******_handler where that is implemented or defined, but for sure we don't have that in our project.

Is it possible that a third party/vendor framework could have that included? if so what's the way to identify in which framework that the broken implementation has?

Written by nareshreddywf in 824598022
Is it possible that a third party/vendor framework could have that included?

Yes. I have a couple of posts that explain how to such questions:

Share and Enjoy

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

Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection &lt;NSConcreteHashTable: 0x30220c780&gt; was mutated while being enumerated.'
 
 
Q