Global DispatchQueue Default-QOS stops processing in iOS 14.1

After a while of using my application, the DispatchQueue Default-QoS stops picking up workloads. I can see them getting queued and everything else in the application is working. This only started happening in iOS 14.1+

Replies

DispatchQueue Default-QoS stops picking up workloads

Do you mean it stops after picking a certain number ? How many ?
Or it does not pick any ?
I’m not sure what’s going on here — I’d need a lot more info to offer insight into that — but my general advice is that you avoid using global dispatch queues (other than the main queue). For advice on our recommended way to use Dispatch, see WWDC 2017 Session 706 Modernizing Grand Central Dispatch Usage.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
We are using the code below to queue all our blocks. It randomly stops I don't see errors, I cant see exceptions in LLDB it just stops running blocks and then continues to accumulate blocks forever.

dispatchqueuet queue = dispatchgetglobalqueue(DISPATCHQUEUEPRIORITYDEFAULT, 0);
    dispatchasyncf(queue, param, proc);

@eskimo, I will try your suggestion but this code has been in place for more than 2 years and it was only in iOS 14.1+ that this started happening.

Thanks,
Vicente


It’s likely that you’ve hit a deadlock caused by overloading Dispatch. Dispatch has a limited number of worker threads and if you send too much work to the global concurrent queue then you can run Dispatch out of worker threads in a way that it can’t recover from. This is known as a “thread explosion” (1), and it’s something we discussed in detail in another WWDC session, WWDC 2015 Session 718 Building Responsive and Efficient Apps with GCD.

Share and Enjoy

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

(1) Well, technically a thread explosion only happens on macOS, where Dispatch supports an unbounded overcommit, but it’s all part of the same ball o’ wax.