couchbase-lite-ios: Crash on [CBLDatabase(Internal) notifyChanges:]
I experiencing that [CBLDatabase(Internal) notifyChanges:] sometimes crashes. I cannot consistently reproduce the issue, but it seems occurs when I put a heavy workload on the manager (performing many writes and reads simultaneously). Again, I cannot force this crash…
The two relevant threads running at the time of the crash has the following stack traces:
Crashed: com.myapp.manager.queue
0 libobjc.A.dylib 0x184dbc150 objc_msgSend + 16
1 CoreFoundation 0x18622c820 <redacted> + 76
2 CoreFoundation 0x18622c790 <redacted> + 640
3 myApp 0x1005b264c -[CBLDatabase(Internal) notifyChanges:] (CBLDatabase+Internal.m:486)
4 myApp 0x10057c404 catchInBlock (CBLDatabase.m:143)
5 libdispatch.dylib 0x1851fe9e0 _dispatch_call_block_and_release + 24
6 libdispatch.dylib 0x1851fe9a0 _dispatch_client_callout + 16
7 libdispatch.dylib 0x18520b604 _dispatch_continuation_pop + 448
8 libdispatch.dylib 0x18520b338 _dispatch_async_redirect_invoke + 608
9 libdispatch.dylib 0x18520ea50 _dispatch_root_queue_drain + 540
10 libdispatch.dylib 0x18520e7d0 _dispatch_worker_thread3 + 124
11 libsystem_pthread.dylib 0x185407100 _pthread_wqthread + 1096
12 libsystem_pthread.dylib 0x185406cac start_wqthread + 4
CouchbaseLite
0 libsystem_platform.dylib 0x185401658 OSAtomicDequeue + 24
1 libsystem_malloc.dylib 0x185387b54 _nano_malloc_check_clear + 156
2 libsystem_malloc.dylib 0x185386c38 nano_malloc + 44
3 libsystem_malloc.dylib 0x185375664 malloc_zone_malloc + 172
4 CoreFoundation 0x18621d044 _CFRuntimeCreateInstance + 336
5 CoreFoundation 0x186232bf8 CFStringCreateMutable + 68
6 Foundation 0x186e3611c <redacted> + 36
7 libswiftCore.dylib 0x101e39390 swift_stdlib_NSStringHashValue + 52
8 libswiftCore.dylib 0x101d7e17c _TTSfq4s___TFSSg9hashValueSi + 192
9 libswiftCore.dylib 0x101d3f07c _TTWSSs8HashablesFS_g9hashValueSi + 48
10 libswiftCore.dylib 0x101cb4214 _TFCs26_SwiftDeferredNSDictionary20bridgingObjectForKeyfPs9AnyObject_GSqPS0___ + 264
11 libswiftCore.dylib 0x101cb40f0 _TFCs26_SwiftDeferredNSDictionary9objectForfPs9AnyObject_GSqPS0___ + 36
12 libswiftCore.dylib 0x101cb4c78 _TToFCs30_HashableTypedNativeSetStorage12getObjectForfPs9AnyObject_GSqPS0____merged + 52
13 myApp 0x1005b5350 -[NSDictionary(CBJSONEncoder) cbjson_encodeTo:canonical:] (CBJSONEncoder.m:249)
14 myApp 0x1005b536c -[NSDictionary(CBJSONEncoder) cbjson_encodeTo:canonical:] (CBJSONEncoder.m:249)
15 myApp 0x1005b5620 -[NSDictionary(CBJSONEncoder) cbjson_encodeTo:canonical:keyFilter:error:] (CBJSONEncoder.m:287)
16 myApp 0x1005b4a78 -[CBJSONEncoder encode:] (CBJSONEncoder.m:96)
17 myApp 0x100538acc +[CBL_Revision asCanonicalJSON:error:] (CBL_Revision.m:251)
18 myApp 0x1005ec794 __103-[CBL_SQLiteStorage addDocID:prevRevID:properties:deleting:allowConflict:validationBlock:status:error:]_block_invoke (CBL_SQLiteStorage.m:1774)
19 myApp 0x1005e6544 -[CBL_SQLiteStorage inTransaction:] (CBL_SQLiteStorage.m:665)
20 myApp 0x1005e6690 -[CBL_SQLiteStorage inOuterTransaction:] (CBL_SQLiteStorage.m:693)
21 myApp 0x1005ec10c -[CBL_SQLiteStorage addDocID:prevRevID:properties:deleting:allowConflict:validationBlock:status:error:] (CBL_SQLiteStorage.m:1670)
22 myApp 0x1005ae990 -[CBLDatabase(Insertion) putDocID:properties:prevRevisionID:allowConflict:source:status:error:] (CBLDatabase+Insertion.m:142)
23 myApp 0x100571bd8 -[CBLDocument putProperties:prevRevID:allowConflict:error:] (CBLDocument.m:324)
24 myApp 0x100576774 -[CBLUnsavedRevision save:] (CBLRevision.m:380)
25 myApp 0x100571d84 -[CBLDocument update:error:] (CBLDocument.m:353)
26 myApp 0x1001f4b40 static Database.(update(for : String, serializedObject : [String : AnyObject], completionClosure : () -> ()?) -> ()).(closure #1) (Database.swift:189)
27 myApp 0x1001f60dc partial apply for static Database.(update(for : String, serializedObject : [String : AnyObject], completionClosure : () -> ()?) -> ()).(closure #1) (Database.swift)
28 myApp 0x1001f3c3c thunk (Database.swift)
29 myApp 0x10053a270 __35-[CBL_Server tellDatabaseNamed:to:]_block_invoke (CBL_Server.m:80)
30 Foundation 0x186e3a4cc <redacted> + 340
31 CoreFoundation 0x1862f542c <redacted> + 24
32 CoreFoundation 0x1862f4d9c <redacted> + 540
33 CoreFoundation 0x1862f29a8 <redacted> + 744
34 CoreFoundation 0x186222da4 CFRunLoopRunSpecific + 424
35 Foundation 0x186d3cd74 <redacted> + 304
36 myApp 0x10053acbc -[CBL_RunLoopServer runServerThread] (CBL_Server.m:193)
37 Foundation 0x186e3a2d8 <redacted> + 996
38 libsystem_pthread.dylib 0x18540968c <redacted> + 240
39 libsystem_pthread.dylib 0x18540959c _pthread_start + 282
40 libsystem_pthread.dylib 0x185406cb4 thread_start + 4
- Version: 1.4.0
- Client OS: iOS 10.3.1
- Server: N/A
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (6 by maintainers)
Thanks for more information. It crashed while adding changes into an array to prepare for notification.
It’s at the place that I don’t expect it to crash. One possible scenario that I can think of now is that the _changesToNotify was released at the same time (from another thread). Need to review the code.
Would it be possible to hook the device/app with the XCode to reproduce the crash in debug mode so that all redacted symbols can show up?