pocket-casts-ios icon indicating copy to clipboard operation
pocket-casts-ios copied to clipboard

Crash: DataManager crash on init

Open pocketcasts opened this issue 2 years ago • 2 comments

Our top Firebase crash at the moment is a DataManager crash on init.

DataModel
DataManager.swift - Line 15860
DataManager.init() + 15860

At first this just looks like something went wrong with statically allocating a DataManager. On closer inspection though, this crash is always from the ShortcutManager class, which is a little suspicious.

The first thing I notice is that for some reason we init this class like this in AppDelegate:

private lazy var shortcutManager: ShortcutManager = .init()

The other possible odd thing is that all of these updates run from the global dispatch queue:

DispatchQueue.global().async {

Which for this crash is always the queue that crashes:

Crashed: com.apple.root.default-qos
EXC_BREAKPOINT 0x0000000102195224

pocketcasts avatar Jul 12 '22 13:07 pocketcasts

More info from Russell:

Looking into this further, both the ShortcutsManager on the global queue and the AppDelegate on the main thread are trying to both initialise a DataManager. image

Screen Shot 2022-05-04 at 6 02 26 pm

The odd thing about this is that it should work in theory. You can see the one on the main thread is locked, while the one on the global queue is initing it. I do wonder though if ShortcutManager being lazily init'd by the AppDelegate and also firing off stuff on another thread during launch might be an issue.

pocketcasts avatar Jul 12 '22 13:07 pocketcasts

This should be fixed in v7.20, but going to leave this issue open as a reminder to check once that ships to enough people to know. It hasn't ever really crashed in our beta's much if at all.

pocketcasts avatar Jul 12 '22 13:07 pocketcasts