iOS
iOS copied to clipboard
Guard against Data Store warmup crash
Task/Issue URL: https://app.asana.com/0/414709148257752/1206900948756754/f Tech Design URL: CC:
Description:
Fix possible crash.
Steps to test this PR:
Validate data clearing/fireproofing after restart with auto clear data on/off.
Clean all tabs, clear data and kill the app. Then validate if it and fireproofing work after restart.
Clear data more than once and see if fireproofing works.
Internal references:
I get a crash (assertion failure) with the following steps:
- Add some favorites
- Fire button
- Launch a favorite
Tried with a clean build just to be sure.
Thread 1#0 0x0000000192c959f8 in _swift_runtime_on_report ()
#1 0x0000000192d369c8 in _swift_stdlib_reportFatalErrorInFile ()
#2 0x00000001929f4710 in closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) ()
#3 0x00000001929f3930 in _assertionFailure(_:_:file:line:flags:) ()
#4 0x00000001929f3bb4 in assertionFailure(_:file:line:) ()
#5 0x00000001056b7f44 in closure #1 in variable initialization expression of static NSObject.DeallocationCheckAction.assert at /Users/brindy/Library/Developer/Xcode/DerivedData/DuckDuckGo-bxugxhicdprphydjawgalyunvmvb/SourcePackages/checkouts/BrowserServicesKit/Sources/Common/Extensions/NSObjectExtension.swift:74
#6 0x00000001056b8d10 in closure #2 in NSObject.ensureObjectDeallocated(after:do:) at /Users/brindy/Library/Developer/Xcode/DerivedData/DuckDuckGo-bxugxhicdprphydjawgalyunvmvb/SourcePackages/checkouts/BrowserServicesKit/Sources/Common/Extensions/NSObjectExtension.swift:96
#7 0x00000001056b8c8c in thunk for @escaping @callee_guaranteed () -> () ()
#8 0x0000000105a62038 in _dispatch_block_async_invoke2 ()
#9 0x0000000105a5193c in _dispatch_client_callout ()
#10 0x0000000105a54ddc in _dispatch_continuation_pop ()
#11 0x0000000105a6a82c in _dispatch_source_invoke ()
#12 0x0000000105a61494 in _dispatch_main_queue_drain ()
#13 0x0000000105a61108 in _dispatch_main_queue_callback_4CF ()
#14 0x00000001803f1a30 in __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ ()
#15 0x00000001803ec148 in __CFRunLoopRun ()
#16 0x00000001803eb5a4 in CFRunLoopRunSpecific ()
#17 0x000000018e9fbae4 in GSEventRunModal ()
#18 0x00000001852f02e4 in -[UIApplication _run] ()
#19 0x00000001852f3f5c in UIApplicationMain ()
#20 0x0000000100fd36d4 in main at /Users/brindy/Projects/DuckDuckGo/iOS/DuckDuckGo/AppDelegate.swift:50
#21 0x00000001040bd544 in start_sim ()
#22 0x00000001043520e0 in start ()
Enqueued from com.apple.main-thread (Thread 1) Queue : com.apple.main-thread (serial)
#0 0x0000000105a6b860 in dispatch_after ()
#1 0x00000001be4273b0 in _swift_dispatch_after ()
#2 0x00000001056b88cc in NSObject.ensureObjectDeallocated(after:do:) at /Users/brindy/Library/Developer/Xcode/DerivedData/DuckDuckGo-bxugxhicdprphydjawgalyunvmvb/SourcePackages/checkouts/BrowserServicesKit/Sources/Common/Extensions/NSObjectExtension.swift:98
#3 0x00000001056b8c48 in NSObject.assertObjectDeallocated(after:) at /Users/brindy/Library/Developer/Xcode/DerivedData/DuckDuckGo-bxugxhicdprphydjawgalyunvmvb/SourcePackages/checkouts/BrowserServicesKit/Sources/Common/Extensions/NSObjectExtension.swift:110
#4 0x0000000101002bd0 in closure #1 in TabViewController.cleanUpBeforeClosing() at /Users/brindy/Projects/DuckDuckGo/iOS/DuckDuckGo/TabViewController.swift:993
#5 0x00000001010029f8 in TabViewController.cleanUpBeforeClosing() at /Users/brindy/Projects/DuckDuckGo/iOS/DuckDuckGo/TabViewController.swift:999
#6 0x0000000101002d68 in TabViewController.__deallocating_deinit at /Users/brindy/Projects/DuckDuckGo/iOS/DuckDuckGo/TabViewController.swift:1006
#7 0x0000000101002dbc in @objc TabViewController.__deallocating_deinit ()
#8 0x00000001800ebf70 in bool HelperBase<GenericInline>::disposeCapture<(HelperBase<GenericInline>::BlockCaptureKind)3>(unsigned int, unsigned char*) ()
#9 0x00000001800ea88c in HelperBase<GenericInline>::destroyBlock(Block_layout*, bool, unsigned char*) ()
#10 0x00000001800ea130 in _call_dispose_helpers_excp ()
#11 0x00000001800eaf54 in _Block_release ()
#12 0x00000001857abbd0 in -[_UIAfterCACommitBlock run] ()
#13 0x00000001857abfd4 in -[_UIAfterCACommitQueue flush] ()
#14 0x0000000105a500f0 in _dispatch_call_block_and_release ()
#15 0x0000000105a5193c in _dispatch_client_callout ()
#16 0x0000000105a615e4 in _dispatch_main_queue_drain ()
#17 0x0000000105a61108 in _dispatch_main_queue_callback_4CF ()
#18 0x00000001803f1a30 in __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ ()
#19 0x00000001803ec148 in __CFRunLoopRun ()
#20 0x00000001803eb5a4 in CFRunLoopRunSpecific ()
#21 0x000000018e9fbae4 in GSEventRunModal ()
#22 0x00000001852f02e4 in -[UIApplication _run] ()
#23 0x00000001852f3f5c in UIApplicationMain ()
#24 0x0000000100fd36d4 in main at /Users/brindy/Projects/DuckDuckGo/iOS/DuckDuckGo/AppDelegate.swift:50
#25 0x00000001040bd544 in start_sim ()
#26 0x00000001043520e0 in start ()
#27 0xf749000000000000 in 0xf749000000000000 ()
Enqueued from com.apple.main-thread (Thread 1) Queue : com.apple.main-thread (serial)
#0 0x0000000105a56c68 in dispatch_async ()
#1 0x00000001857abf20 in __57-[_UIAfterCACommitQueue _enqueueCommitResponse:forPhase:]_block_invoke ()
#2 0x0000000189f50484 in CA::Transaction::run_commit_handlers(CATransactionPhase) ()
#3 0x0000000189f240b4 in CA::Context::commit_transaction(CA::Transaction*, double, double*) ()
#4 0x0000000189f4fcc0 in CA::Transaction::commit() ()
#5 0x0000000189e4e394 in CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) ()
#6 0x0000000189e4dd74 in CA::Display::DisplayLink::callback(_CADisplayTimer*, unsigned long long, unsigned long long, unsigned long long, bool, void*) ()
#7 0x0000000189f54c8c in display_timer_callback(__CFMachPort*, void*, long, void*) ()
#8 0x00000001803bbd20 in __CFMachPortPerform ()
#9 0x00000001803f2658 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#10 0x00000001803f1c28 in __CFRunLoopDoSource1 ()
#11 0x00000001803ec238 in __CFRunLoopRun ()
#12 0x00000001803eb5a4 in CFRunLoopRunSpecific ()
#13 0x000000018e9fbae4 in GSEventRunModal ()
#14 0x00000001852f02e4 in -[UIApplication _run] ()
#15 0x00000001852f3f5c in UIApplicationMain ()
#16 0x0000000100fd36d4 in main at /Users/brindy/Projects/DuckDuckGo/iOS/DuckDuckGo/AppDelegate.swift:50
#17 0x00000001040bd544 in start_sim ()
#18 0x00000001043520e0 in start ()
#19 0xf749000000000000 in 0xf749000000000000 ()
@brindy this is a leak we've had on main, so I've merged latest main (with fix) and pushed out, please check again.