couchbase / couchbase-lite-ios

Lightweight, embedded, syncable NoSQL database engine for iOS and MacOS apps.
Apache License 2.0
1.63k stars 297 forks source link

test_URLProtocol and URLProtocol_Registration crashed #1596

Closed pasin closed 7 years ago

pasin commented 7 years ago

Log:

2017-01-30 17:21:50.306830 CBL Test[1013:185655] ---- Using SQLite ----
2017-01-30 17:21:50.361031 CBL Test[1013:185655] WARNING: SQLite error (code 1): no such table: cfurl_cache_response {at errorLogCallback:123}
2017-01-30 17:21:50.362736 CBL Test[1013:185655] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Warn() was called from errorLogCallback:123: SQLite error (code 1): no such table: cfurl_cache_response'
*** First throw call stack:
(0x1936091b8 0x19204055c 0x193609100 0x100459f88 0x1007babc0 0x193b1ce68 0x193afe9c4 0x193afdf24 0x193afdae0 0x193cd0350 0x193cd00f0 0x193ca7ee4 0x193ca7c74 0x193dde1a4 0x193dddb14 0x193c0ca38 0x193c0cb1c 0x1924921bc 0x192492fb0 0x193c0caf8 0x193d80a20 0x193d84bb0 0x193cd5fa0 0x193cd5818 0x193cdddec 0x193cddc94 0x193cbdee0 0x193cbdbd8 0x193ce7de0 0x1064dcfd8 0x19360f150 0x193501eac 0x101c860a8 0x101cbac98 0x101c85f0c 0x106607f1c 0x101c865e0 0x101c83a5c 0x101c83a5c 0x101c83a5c 0x101c6f740 0x101c90260 0x101c6f5d8 0x101c703b4 0x101cbc164 0x1935b6a44 0x1935b6240 0x1935b4094 0x1934e22b8 0x194f96198 0x1995297fc 0x199524534 0x10004c110 0x1924c55b8)
libc++abi.dylib: terminating with uncaught exception of type NSException

BT:

* thread #1: tid = 0x2d537, 0x00000001925d7014 libsystem_kernel.dylib`__pthread_kill + 8, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00000001925d7014 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x000000019269f450 libsystem_pthread.dylib`pthread_kill + 112
    frame #2: 0x000000019254b400 libsystem_c.dylib`abort + 140
    frame #3: 0x00000001920152d4 libc++abi.dylib`abort_message + 132
    frame #4: 0x0000000192032cc0 libc++abi.dylib`default_terminate_handler() + 304
    frame #5: 0x0000000192040844 libobjc.A.dylib`_objc_terminate() + 124
    frame #6: 0x000000019202f66c libc++abi.dylib`std::__terminate(void (*)()) + 16
    frame #7: 0x000000019202ef84 libc++abi.dylib`__cxa_throw + 136
    frame #8: 0x0000000192040690 libobjc.A.dylib`objc_exception_throw + 364
    frame #9: 0x0000000193609100 CoreFoundation`+[NSException raise:format:] + 116
    frame #10: 0x0000000100459f88 CBL Test`MYWarn(where="errorLogCallback", line=123, msg=@"SQLite error (code %d): %s") + 1168 at MYLogging.m:308
    frame #11: 0x00000001007babc0 CBL Test`errorLogCallback(pArg=0x0000000000000000, errCode=1, msg="no such table: cfurl_cache_response") + 292 at CBL_SQLiteStorage.m:123
    frame #12: 0x0000000193b1ce68 libsqlite3.dylib`sqlite3_log + 132
    frame #13: 0x0000000193afe9c4 libsqlite3.dylib`___lldb_unnamed_symbol36$$libsqlite3.dylib + 744
    frame #14: 0x0000000193afdf24 libsqlite3.dylib`___lldb_unnamed_symbol35$$libsqlite3.dylib + 928
    frame #15: 0x0000000193afdae0 libsqlite3.dylib`___lldb_unnamed_symbol34$$libsqlite3.dylib + 456
    frame #16: 0x0000000193cd0350 CFNetwork`-[NSURLCacheDBReader _prepareDBSelectStatements] + 164
    frame #17: 0x0000000193cd00f0 CFNetwork`-[NSURLCacheDBReader openAndPrepareReadCacheDB] + 48
    frame #18: 0x0000000193ca7ee4 CFNetwork`__CFURLCache::createNSURLStorageClient(__CFString const*, long, std::__1::shared_ptr<__CFURLCache>) + 140
    frame #19: 0x0000000193ca7c74 CFNetwork`__CFURLCacheCreateInternal(__CFAllocator const*, long, long, __CFString const*, bool, bool) + 532
    frame #20: 0x0000000193dde1a4 CFNetwork`-[NSURLCache initWithMemoryCapacity:diskCapacity:diskPath:] + 164
    frame #21: 0x0000000193dddb14 CFNetwork`+[NSURLCache sharedURLCache] + 96
    frame #22: 0x0000000193c0ca38 CFNetwork`-[__NSURLSessionLocal _createXURLCache0] + 40
    frame #23: 0x0000000193c0cb1c CFNetwork`__39-[__NSURLSessionLocal _createXURLCache]_block_invoke + 32
    frame #24: 0x00000001924921bc libdispatch.dylib`_dispatch_client_callout + 16
    frame #25: 0x0000000192492fb0 libdispatch.dylib`dispatch_once_f + 56
    frame #26: 0x0000000193c0caf8 CFNetwork`-[__NSURLSessionLocal _createXURLCache] + 152
    frame #27: 0x0000000193d80a20 CFNetwork`URLConnectionClient::URLConnectionClient(ClassicURLConnection*, NSURLSessionTask const*, dispatch_queue_s*) + 140
    frame #28: 0x0000000193d84bb0 CFNetwork`URLConnectionClient_Classic::URLConnectionClient_Classic(ClassicURLConnection*, NSURLSessionTask const*, CFURLConnectionClient_V1 const*, dispatch_queue_s*) + 28
    frame #29: 0x0000000193cd5fa0 CFNetwork`ClassicURLConnection::initialize(CFURLConnectionClient_V1*, NSURLSessionTask const*) + 144
    frame #30: 0x0000000193cd5818 CFNetwork`ClassicURLConnection::initialize(_CFURLRequest const*, _CFURLRequest*, CFURLConnectionClient_V1*, __CFDictionary const*) + 252
    frame #31: 0x0000000193cdddec CFNetwork`CFURLConnectionCreateWithProperties + 308
    frame #32: 0x0000000193cddc94 CFNetwork`CFURLConnectionCreate + 60
    frame #33: 0x0000000193cbdee0 CFNetwork`SyncClient::SyncClient(__CFAllocator const*, _CFURLRequest const*, dispatch_queue_s*, void (__CFData const*, _CFURLResponse*, __CFError*) block_pointer) + 224
    frame #34: 0x0000000193cbdbd8 CFNetwork`CFURLConnectionSendSynchronousRequest + 264
    frame #35: 0x0000000193ce7de0 CFNetwork`+[NSURLConnection sendSynchronousRequest:returningResponse:error:] + 120
  * frame #36: 0x00000001064dcfd8 CBL iOS Unit Tests`-[Router_Tests test_URLProtocol](self=0x00000001052da360, _cmd="test_URLProtocol") + 1936 at Router_Tests.m:1497
    frame #37: 0x000000019360f150 CoreFoundation`__invoking___ + 144
    frame #38: 0x0000000193501eac CoreFoundation`-[NSInvocation invoke] + 284
    frame #39: 0x0000000101c860a8 XCTest`__24-[XCTestCase invokeTest]_block_invoke_2 + 388
    frame #40: 0x0000000101cbac98 XCTest`-[XCTestContext performInScope:] + 208
    frame #41: 0x0000000101c85f0c XCTest`-[XCTestCase invokeTest] + 268
    frame #42: 0x0000000106607f1c CBL iOS Unit Tests`-[CBLTestCaseWithDB invokeTest](self=0x00000001052da360, _cmd="invokeTest") + 592 at CBLTestCase.m:167
    frame #43: 0x0000000101c865e0 XCTest`-[XCTestCase performTest:] + 460
    frame #44: 0x0000000101c83a5c XCTest`-[XCTestSuite performTest:] + 428
    frame #45: 0x0000000101c83a5c XCTest`-[XCTestSuite performTest:] + 428
    frame #46: 0x0000000101c83a5c XCTest`-[XCTestSuite performTest:] + 428
    frame #47: 0x0000000101c6f740 XCTest`__25-[XCTestDriver _runSuite]_block_invoke + 56
    frame #48: 0x0000000101c90260 XCTest`-[XCTestObservationCenter _observeTestExecutionForBlock:] + 528
    frame #49: 0x0000000101c6f5d8 XCTest`-[XCTestDriver _runSuite] + 460
    frame #50: 0x0000000101c703b4 XCTest`-[XCTestDriver _checkForTestManager] + 296
    frame #51: 0x0000000101cbc164 XCTest`_XCTestMain + 628
    frame #52: 0x00000001935b6a44 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
    frame #53: 0x00000001935b6240 CoreFoundation`__CFRunLoopDoBlocks + 288
    frame #54: 0x00000001935b4094 CoreFoundation`__CFRunLoopRun + 788
    frame #55: 0x00000001934e22b8 CoreFoundation`CFRunLoopRunSpecific + 444
    frame #56: 0x0000000194f96198 GraphicsServices`GSEventRunModal + 180
    frame #57: 0x00000001995297fc UIKit`-[UIApplication _run] + 684
    frame #58: 0x0000000199524534 UIKit`UIApplicationMain + 208
    frame #59: 0x000000010004c110 CBL Test`main(argc=7, argv=0x000000016fdbf4e0) + 184 at main.m:18
    frame #60: 0x00000001924c55b8 libdyld.dylib`start + 4

  thread #3: tid = 0x2d581, 0x00000001925d7a88 libsystem_kernel.dylib`__workq_kernreturn + 8
    frame #0: 0x00000001925d7a88 libsystem_kernel.dylib`__workq_kernreturn + 8
    frame #1: 0x000000019269b344 libsystem_pthread.dylib`_pthread_wqthread + 1452
    frame #2: 0x000000019269ad8c libsystem_pthread.dylib`start_wqthread + 4

  thread #4: tid = 0x2d582, 0x00000001925b91c4 libsystem_kernel.dylib`semaphore_wait_trap + 8, queue = 'parsing queue'
    frame #0: 0x00000001925b91c4 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x00000001924a47d8 libdispatch.dylib`_dispatch_semaphore_wait_slow + 216
    frame #2: 0x000000010d2d50d4 DTXConnectionServices`-[DTXMessageParser waitForMoreData:incrementalBuffer:] + 108
    frame #3: 0x000000010d2d4c28 DTXConnectionServices`-[DTXMessageParser parseMessageWithExceptionHandler:] + 68
    frame #4: 0x000000010d2d4994 DTXConnectionServices`__68-[DTXMessageParser initWithMessageHandler:andParseExceptionHandler:]_block_invoke + 40
    frame #5: 0x0000000100f1f3dc libclang_rt.asan_ios_dynamic.dylib`__wrap_dispatch_async_block_invoke + 228
    frame #6: 0x00000001924921fc libdispatch.dylib`_dispatch_call_block_and_release + 24
    frame #7: 0x00000001924921bc libdispatch.dylib`_dispatch_client_callout + 16
    frame #8: 0x00000001924a03dc libdispatch.dylib`_dispatch_queue_serial_drain + 928
    frame #9: 0x00000001924959a4 libdispatch.dylib`_dispatch_queue_invoke + 652
    frame #10: 0x00000001924a08d8 libdispatch.dylib`_dispatch_queue_override_invoke + 360
    frame #11: 0x00000001924a234c libdispatch.dylib`_dispatch_root_queue_drain + 572
    frame #12: 0x00000001924a20ac libdispatch.dylib`_dispatch_worker_thread3 + 124
    frame #13: 0x000000019269b2a0 libsystem_pthread.dylib`_pthread_wqthread + 1288
    frame #14: 0x000000019269ad8c libsystem_pthread.dylib`start_wqthread + 4

  thread #5: tid = 0x2d583, 0x00000001925d7a88 libsystem_kernel.dylib`__workq_kernreturn + 8
    frame #0: 0x00000001925d7a88 libsystem_kernel.dylib`__workq_kernreturn + 8
    frame #1: 0x000000019269b344 libsystem_pthread.dylib`_pthread_wqthread + 1452
    frame #2: 0x000000019269ad8c libsystem_pthread.dylib`start_wqthread + 4

  thread #6: tid = 0x2d584, 0x00000001925d7a88 libsystem_kernel.dylib`__workq_kernreturn + 8
    frame #0: 0x00000001925d7a88 libsystem_kernel.dylib`__workq_kernreturn + 8
    frame #1: 0x000000019269b344 libsystem_pthread.dylib`_pthread_wqthread + 1452
    frame #2: 0x000000019269ad8c libsystem_pthread.dylib`start_wqthread + 4

  thread #7: tid = 0x2d586, 0x00000001925b9188 libsystem_kernel.dylib`mach_msg_trap + 8, name = 'com.apple.uikit.eventfetch-thread'
    frame #0: 0x00000001925b9188 libsystem_kernel.dylib`mach_msg_trap + 8
    frame #1: 0x00000001925b8ff8 libsystem_kernel.dylib`mach_msg + 72
    frame #2: 0x00000001935b65d0 CoreFoundation`__CFRunLoopServiceMachPort + 192
    frame #3: 0x00000001935b41ec CoreFoundation`__CFRunLoopRun + 1132
    frame #4: 0x00000001934e22b8 CoreFoundation`CFRunLoopRunSpecific + 444
    frame #5: 0x000000019401f26c Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
    frame #6: 0x000000019403fdd0 Foundation`-[NSRunLoop(NSRunLoop) runUntilDate:] + 96
    frame #7: 0x0000000199e9dc38 UIKit`-[UIEventFetcher threadMain] + 136
    frame #8: 0x000000019411ce68 Foundation`__NSThread__start__ + 1024
    frame #9: 0x000000019269d850 libsystem_pthread.dylib`_pthread_body + 240
    frame #10: 0x000000019269d760 libsystem_pthread.dylib`_pthread_start + 284
    frame #11: 0x000000019269ad94 libsystem_pthread.dylib`thread_start + 4

  thread #8: tid = 0x2d58f, 0x00000001925d7a88 libsystem_kernel.dylib`__workq_kernreturn + 8
    frame #0: 0x00000001925d7a88 libsystem_kernel.dylib`__workq_kernreturn + 8
    frame #1: 0x000000019269b160 libsystem_pthread.dylib`_pthread_wqthread + 968
    frame #2: 0x000000019269ad8c libsystem_pthread.dylib`start_wqthread + 4

  thread #9: tid = 0x2d5ab, 0x00000001925b9188 libsystem_kernel.dylib`mach_msg_trap + 8, name = 'CouchbaseLite'
    frame #0: 0x00000001925b9188 libsystem_kernel.dylib`mach_msg_trap + 8
    frame #1: 0x00000001925b8ff8 libsystem_kernel.dylib`mach_msg + 72
    frame #2: 0x00000001935b65d0 CoreFoundation`__CFRunLoopServiceMachPort + 192
    frame #3: 0x00000001935b41ec CoreFoundation`__CFRunLoopRun + 1132
    frame #4: 0x00000001934e22b8 CoreFoundation`CFRunLoopRunSpecific + 444
    frame #5: 0x000000019401f26c Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
    frame #6: 0x00000001003f8a04 CBL Test`-[CBL_RunLoopServer runServerThread](self=0x0000000104659050, _cmd="runServerThread") + 1160 at CBL_Server.m:193
    frame #7: 0x000000019411ce68 Foundation`__NSThread__start__ + 1024
    frame #8: 0x000000019269d850 libsystem_pthread.dylib`_pthread_body + 240
    frame #9: 0x000000019269d760 libsystem_pthread.dylib`_pthread_start + 284
    frame #10: 0x000000019269ad94 libsystem_pthread.dylib`thread_start + 4

pasin commented 7 years ago

I think we need to handle this error in the SQLite Error Callback.