Closed Bug 1194664 Opened 6 years ago Closed 6 years ago

Crash when running Session Restore tests - deallocation of webview with registered NSKeyValueObservers

Categories

(Firefox for iOS :: Build & Test, defect)

Other
iOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
fxios + ---

People

(Reporter: fluffyemily, Assigned: sleroux)

Details

Attachments

(1 file)

Running in iPhone6 8.4 Simulator

2015-08-14 11:58:16.335 [Debug] [SwiftData.swift:126] transaction: Op in transaction succeeded. Committing.
<unknown>:0: error: -[UITests.SessionRestoreTests testTabRestore] : failed: caught "NSInternalInconsistencyException", "An instance 0x7fd66c7be350 of class WKWebView was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x7fd66e0f2130> (
<NSKeyValueObservance 0x7fd66e1f7950: Observer: 0x7fd66962fcc0, Key path: URL, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x7fd6694dd930>
)"
(
	0   CoreFoundation                      0x0000000106c01c65 __exceptionPreprocess + 165
	1   libobjc.A.dylib                     0x0000000106129bb7 objc_exception_throw + 45
	2   CoreFoundation                      0x0000000106c01b9d +[NSException raise:format:] + 205
	3   Foundation                          0x0000000105d05332 NSKVODeallocate + 317
	4   CoreFoundation                      0x0000000106ad78eb CFRelease + 603
	5   CoreFoundation                      0x0000000106aeb21d -[__NSArrayM dealloc] + 157
	6   libobjc.A.dylib                     0x000000010613e28e _ZN11objc_object17sidetable_releaseEb + 236
	7   libobjc.A.dylib                     0x000000010613e8cd _ZN12_GLOBAL__N_119AutoreleasePoolPage3popEPv + 591
	8   XCTest                              0x0000000115493391 -[XCTestCase performTest:] + 174
	9   XCTest                              0x000000011549cc35 -[XCTest run] + 260
	10  XCTest                              0x000000011549208b -[XCTestSuite performTest:] + 379
	11  XCTest                              0x000000011549cc35 -[XCTest run] + 260
	12  XCTest                              0x000000011549208b -[XCTestSuite performTest:] + 379
	13  XCTest                              0x000000011549cc35 -[XCTest run] + 260
	14  XCTest                              0x000000011549208b -[XCTestSuite performTest:] + 379
	15  XCTest                              0x000000011549cc35 -[XCTest run] + 260
	16  XCTest                              0x000000011548f129 __25-[XCTestDriver _runSuite]_block_invoke + 56
	17  XCTest                              0x0000000115499edd -[XCTestObservationCenter _observeTestExecutionForBlock:] + 162
	18  XCTest                              0x000000011548f060 -[XCTestDriver _runSuite] + 269
	19  XCTest                              0x000000011548fa8d -[XCTestDriver _checkForTestManager] + 234
	20  XCTest                              0x000000011549fb20 +[XCTestProbe runTests:] + 182
	21  Foundation                          0x0000000105cdc1e5 __NSFireDelayedPerform + 387
	22  CoreFoundation                      0x0000000106b69174 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
	23  CoreFoundation                      0x0000000106b68d35 __CFRunLoopDoTimer + 1045
	24  CoreFoundation                      0x0000000106b2ad3d __CFRunLoopRun + 1901
	25  CoreFoundation                      0x0000000106b2a366 CFRunLoopRunSpecific + 470
	26  GraphicsServices                    0x000000010abb0a3e GSEventRunModal + 161
	27  UIKit                               0x00000001078d88c0 UIApplicationMain + 1282
	28  Client                              0x0000000104465017 main + 1047
	29  libdyld.dylib                       0x0000000109876145 start + 1
	30  ???                                 0x000000000000000a 0x0 + 10
)
Test Case '-[UITests.SessionRestoreTests testTabRestore]' failed (13.355 seconds).
This also causes a EXC_BAD_ACCESS crash to occur later on line 1015 BrowserViewController:browser(browser:, willDeleteWebView webView:)  when running TopSitesTests->testRotatingOnTopSites. Crash does not occur if SessionRestoreTests are not run first.
Assignee: nobody → sleroux
Attachment #8648131 - Flags: review?(bnicholson)
Comment on attachment 8648131 [details] [review]
https://github.com/mozilla/firefox-ios/pull/933

Looks OK, though I'm wondering if we can simplify this KVO registration code as mentioned in the PR.
Attachment #8648131 - Flags: review?(bnicholson) → review+
Simplified KVO stuff. Merged.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.