Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Consistent Dispatch queue: com.apple.root.default-qos.overcommit crash

Tags:

macos

cocoa

crash

Anyone had experience diagnosing these crashes? I have a single user getting them consistently, and though I found an iOS related post, my app is not crashing on the same type of operation...

like image 871
JeremyLaurenson Avatar asked Jan 14 '15 17:01

JeremyLaurenson


People also ask

What is com apple root DEFAULT QOS overcommit?

default-qos. overcommit" Periodic crashes are occurring in areas where a frequent number of dispatches to the Default QOS queue are occuring. A search about this identifier generally says that there are too many items submitted to this queue and that iOS will not run the method, and that it can lead to a crash.

What is Exc_breakpoint?

EXC_BREAKPOINT (SIGTRAP) is a trace trap interrupted the process. It gives an attached debugger, if any, a chance to interrupt the process at a specific point in its execution.


2 Answers

Reason:

in iOS / tvOS there are queues / threads, each thread has its own type or priority also known as a "quality of service" or for short "QOS", which means the level of urgency that the cpu should handle this thread, the possibilities are:

  • QOS_CLASS_DEFAULT
  • QOS_CLASS_USER_INITIATED
  • QOS_CLASS_UTILITY
  • QOS_CLASS_BACKGROUND
  • QOS_CLASS_UNSPECIFIED
  • QOS_CLASS_USER_INTERACTIVE

once you run too many tasks at the same time in the same queue, then the OS notifies you that it cannot perform all this tasks at the same time in the same priority (there is a limit to the size of the stack for each queue), there for it says "OverCommit", which means you have over committed the queue (in your case the "Default-QOS" queue) and it exits since it cannot receive more tasks at this time and execute them at the fashion you want.

solution:

what you should do is first find the "dispatch_async" command that causes this crash, then use one of the other queues (it means expecting slower response then expected for that task),

usually developer don't think about it and simply use main queue which is the default priority / queue like this:

dispatch_async(dispatch_get_main_queue()) {     // some task to perform     print("This is my task") } 

in order to fix this (if the app notifies you that you have overcommitted the main queue) is to change it to one of the other queues like this:

let qualityOfServiceClass = QOS_CLASS_BACKGROUND let backgroundQueue = dispatch_get_global_queue(qualityOfServiceClass, 0) dispatch_async(backgroundQueue, {     // some task to perform     print("This is my task") }) 

if you do not require a background (or parallel) execution, you can even ignore the dispatch_async command altogether and simply execute you commands like this:

// some task to perform print("This is my task") 
like image 190
Shaybc Avatar answered Oct 05 '22 16:10

Shaybc


Rewrite Shaybc's answer in Swift 3:

DispatchQueue.global(qos: .background).async {   // some task to perform   print("This is my task") }) 
like image 21
Bill Chan Avatar answered Oct 05 '22 15:10

Bill Chan