Page MenuHomePhabricator

Fix crashes related to UI access from a non-main thread in history
Closed, ResolvedPublic

Description

Crash reports in Xcode, example stack trace:

Last Exception Backtrace:
0   CoreFoundation                	0x1b893496c __exceptionPreprocess + 224 (NSException.m:199)
1   libobjc.A.dylib               	0x1b864d028 objc_exception_throw + 60 (objc-exception.mm:565)
2   Foundation                    	0x1b8e205e0 _AssertAutolayoutOnAllowedThreadsOnly + 324 (NSISEngine.m:0)
3   Foundation                    	0x1b8c198c4 -[NSISEngine _optimizeWithoutRebuilding] + 72 (NSISEngine.m:1640)
4   Foundation                    	0x1b8c197d8 -[NSISEngine optimize] + 116 (NSISEngine.m:1614)
5   Foundation                    	0x1b8c19448 -[NSISEngine performPendingChangeNotifications] + 116 (NSISEngine.m:632)
6   UIKitCore                     	0x1bcec1348 -[UIView(Hierarchy) layoutBelowIfNeeded] + 244 (UIView.m:11877)
7   Wikipedia                     	0x100cfba4c specialized PageHistoryCountsViewController.timeseriesOfEditsCounts.didset + 196 (PageHistoryCountsViewController.swift:61)
8   Wikipedia                     	0x100c93a04 closure #3 in PageHistoryViewController.getEditCounts() + 844 (PageHistoryViewController.swift:0)
9   Wikipedia                     	0x100d21270 closure #1 in closure #1 in PageHistoryFetcher.fetchEditMetrics(for:pageURL:completion:) + 412 (PageHistoryFetcher.swift:233)
10  Wikipedia                     	0x100d28b04 partial apply for thunk for @escaping @callee_guaranteed (@guaranteed PageHistoryFetcher.EditMetr... + 24 (<compiler-generated>:0)
11  WMF                           	0x101467860 closure #1 in Session.jsonDecodableTask<A>(with:method:bodyParameters:bodyEncoding:headers:priori... + 1068 (Session.swift:327)
12  WMF                           	0x10146b8e4 partial apply for closure #1 in Session.jsonDecodableTask<A>(with:method:bodyParameters:bodyEncod... + 32 (<compiler-generated>:0)
13  WMF                           	0x1014605e4 thunk for @escaping @callee_guaranteed (@guaranteed Data?, @guaranteed NSURLResponse?, @guarantee... + 148 (<compiler-generated>:0)
14  CFNetwork                     	0x1bbbc1c28 __40-[__NSURLSessionLocal taskForClassInfo:]_block_invoke + 316 (LocalSession.mm:718)
15  CFNetwork                     	0x1bbbd2970 __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke + 224 (LocalSessionTask.mm:566)
16  Foundation                    	0x1b8d04a44 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 24 (NSOperation.m:1541)
17  Foundation                    	0x1b8c06518 -[NSBlockOperation main] + 104 (NSOperation.m:1560)
18  Foundation                    	0x1b8d06da0 __NSOPERATION_IS_INVOKING_MAIN__ + 24 (NSOperation.m:2184)
19  Foundation                    	0x1b8c06194 -[NSOperation start] + 740 (NSOperation.m:2201)
20  Foundation                    	0x1b8d077cc __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 24 (NSOperation.m:2215)
21  Foundation                    	0x1b8d0728c __NSOQSchedule_f + 184 (NSOperation.m:2226)
22  libdispatch.dylib             	0x1b85e639c _dispatch_block_async_invoke2 + 144 (queue.c:525)
23  libdispatch.dylib             	0x1b85d9fd8 _dispatch_client_callout + 20 (object.m:495)
24  libdispatch.dylib             	0x1b85e0450 _dispatch_lane_serial_drain + 568 (inline_internal.h:2484)
25  libdispatch.dylib             	0x1b85e0eb4 _dispatch_lane_invoke + 424 (inline_internal.h:1851)
26  libdispatch.dylib             	0x1b85e9f20 _dispatch_workloop_worker_thread + 580 (queue.c:6445)
27  libsystem_pthread.dylib       	0x1b863f6d0 _pthread_wqthread + 280 (pthread.c:2352)
28  libsystem_pthread.dylib       	0x1b86459e8 start_wqthread + 8

Event Timeline

JoeWalsh triaged this task as Medium priority.
JoeWalsh moved this task from Needs Triage to Bug Backlog on the Wikipedia-iOS-App-Backlog board.

@JoeWalsh Is this related to the issue where the app would crash when opening a link into article history? Are there any special repro steps here? Thanks

@ABorbaWMF this one wouldn't repro 100% (only happened when the server returned an error) so opening links into some different article histories should be enough to test