ChatSecure-iOS icon indicating copy to clipboard operation
ChatSecure-iOS copied to clipboard

Crash on launch - reabstraction thunk helper swift_getObjectType

Open chrisballinger opened this issue 6 years ago • 8 comments

Not really sure what's happening here, but it's the new top crash and happening to a fair amount of users in the v4.3.1 rollout. I don't see a similar crash on v4.3.0 so there must have been a regression.

Thread 13 Crashed:
0   libswiftCore.dylib              0x000000010210ba94 0x101e50000 + 2865812 (swift_getObjectType + 60)
1   ChatSecureCore                  0x0000000101964f38 reabstraction thunk helper from @escaping @callee_guaranteed (@owned Swift.String, @owned Swift.String, @in Any, @unowned Swift.UnsafeMutablePointer<ObjectiveC.ObjCBool>) -> () to @escaping @callee_unowned @convention(block) (@unowned __C.NSString, @unowned __C.NSString, @unowned Swift.AnyObject, @unowned Swift.UnsafeMutablePointer<ObjectiveC.ObjCBool>) -> () (YapDatabaseTransaction+ChatSecure.swift:0)
2   ChatSecureCore                  0x0000000101964f38 reabstraction thunk helper from @escaping @callee_guaranteed (@owned Swift.String, @owned Swift.String, @in Any, @unowned Swift.UnsafeMutablePointer<ObjectiveC.ObjCBool>) -> () to @escaping @callee_unowned @convention(block) (@unowned __C.NSString, @unowned __C.NSString, @unowned Swift.AnyObject, @unowned Swift.UnsafeMutablePointer<ObjectiveC.ObjCBool>) -> () (YapDatabaseTransaction+ChatSecure.swift:0)
3   YapDatabase                     0x00000001013e1a34 __88-[YapDatabaseSecondaryIndexTransaction enumerateKeysAndObjectsMatchingQuery:usingBlock:]_block_invoke (YapDatabaseSecondaryIndexTransaction.m:1290)
4   YapDatabase                     0x00000001013e12e4 -[YapDatabaseSecondaryIndexTransaction _enumerateRowidsMatchingQuery:usingBlock:] (YapDatabaseSecondaryIndexTransaction.m:1211)
5   YapDatabase                     0x00000001013e1938 -[YapDatabaseSecondaryIndexTransaction enumerateKeysAndObjectsMatchingQuery:usingBlock:] (YapDatabaseSecondaryIndexTransaction.m:1278)
6   ChatSecureCore                  0x0000000101968f68 function signature specialization <Arg[0] = Owned To Guaranteed> of (extension in ChatSecureCore):__C.YapDatabaseReadTransaction.enumerateUnfinishedDownloads((__C.OTRMediaItem, Swift.UnsafeMutablePointer<ObjectiveC.ObjCBool>) -> ()) -> () (YapDatabaseTransaction+ChatSecure.swift:157)
7   ChatSecureCore                  0x0000000101965fc4 merged @objc (extension in ChatSecureCore):__C.YapDatabaseReadTransaction.enumerateUnreadMessages((__C.OTRMessageProtocol, Swift.UnsafeMutablePointer<ObjectiveC.ObjCBool>) -> ()) -> () + 92
8   ChatSecureCore                  0x00000001018dff0c partial apply forwarder for closure #1 (__C.YapDatabaseReadTransaction) -> () in ChatSecureCore.FileTransferManager.resumeDownloads() -> () (FileTransferManager.swift:159)
9   ChatSecureCore                  0x0000000101964ea8 reabstraction thunk helper from @escaping @callee_guaranteed (@owned __C.YapDatabaseReadTransaction) -> () to @escaping @callee_unowned @convention(block) (@unowned __C.YapDatabaseReadTransaction) -> () (YapDatabaseTransaction+ChatSecure.swift:0)
10  YapDatabase                     0x0000000101388f5c __76-[YapDatabaseConnection asyncReadWithBlock:completionQueue:completionBlock:]_block_invoke (YapDatabaseConnection.m:2222)
11  libdispatch.dylib               0x000000018b0229e0 _dispatch_call_block_and_release + 20
12  libdispatch.dylib               0x000000018b0229a0 _dispatch_client_callout + 12
13  libdispatch.dylib               0x000000018b030ad4 _dispatch_queue_serial_drain + 924
14  libdispatch.dylib               0x000000018b0262cc _dispatch_queue_invoke + 880
15  libdispatch.dylib               0x000000018b032a50 _dispatch_root_queue_drain + 536
16  libdispatch.dylib               0x000000018b0327d0 _dispatch_worker_thread3 + 120
17  libsystem_pthread.dylib         0x000000018b22b100 _pthread_wqthread + 1092

chrisballinger avatar Jul 12 '18 15:07 chrisballinger

Possibly related: https://bugs.swift.org/browse/SR-7719

chrisballinger avatar Jul 12 '18 16:07 chrisballinger

Same issue on v4.3.2 after the first attempt at fixing it:

Thread 6 Crashed:
0   libswiftCore.dylib              0x0000000104343a94 0x104088000 + 2865812 (swift_getObjectType + 60)
1   ChatSecureCore                  0x0000000103b74824 reabstraction thunk helper from @escaping @callee_guaranteed (@owned Swift.String, @owned Swift.String, @in Any, @unowned Swift.UnsafeMutablePointer<ObjectiveC.ObjCBool>) -> () to @escaping @callee_unowned @convention(block) (@unowned __C.NSString, @unowned __C.NSString, @unowned Swift.AnyObject, @unowned Swift.UnsafeMutablePointer<ObjectiveC.ObjCBool>) -> () (YapDatabaseTransaction+ChatSecure.swift:0)
2   ChatSecureCore                  0x0000000103b74824 reabstraction thunk helper from @escaping @callee_guaranteed (@owned Swift.String, @owned Swift.String, @in Any, @unowned Swift.UnsafeMutablePointer<ObjectiveC.ObjCBool>) -> () to @escaping @callee_unowned @convention(block) (@unowned __C.NSString, @unowned __C.NSString, @unowned Swift.AnyObject, @unowned Swift.UnsafeMutablePointer<ObjectiveC.ObjCBool>) -> () (YapDatabaseTransaction+ChatSecure.swift:0)
3   YapDatabase                     0x00000001035e9a34 __88-[YapDatabaseSecondaryIndexTransaction enumerateKeysAndObjectsMatchingQuery:usingBlock:]_block_invoke (YapDatabaseSecondaryIndexTransaction.m:1290)
4   YapDatabase                     0x00000001035e92e4 -[YapDatabaseSecondaryIndexTransaction _enumerateRowidsMatchingQuery:usingBlock:] (YapDatabaseSecondaryIndexTransaction.m:1211)
5   YapDatabase                     0x00000001035e9938 -[YapDatabaseSecondaryIndexTransaction enumerateKeysAndObjectsMatchingQuery:usingBlock:] (YapDatabaseSecondaryIndexTransaction.m:1278)
6   ChatSecureCore                  0x0000000103b74bdc (extension in ChatSecureCore):__C.YapDatabaseReadTransaction.unfinishedDownloads() -> [__C.OTRMediaItem] (YapDatabaseTransaction+ChatSecure.swift:158)
7   ChatSecureCore                  0x0000000103aefeb8 function signature specialization <Arg[0] = Owned To Guaranteed> of closure #1 (__C.YapDatabaseReadTransaction) -> () in ChatSecureCore.FileTransferManager.resumeDownloads() -> () (FileTransferManager.swift:159)
8   ChatSecureCore                  0x0000000103aef8ac partial apply forwarder for closure #1 (__C.YapDatabaseReadTransaction) -> () in ChatSecureCore.FileTransferManager.resumeDownloads() -> () (FileTransferManager.swift:0)
9   ChatSecureCore                  0x0000000103b74794 reabstraction thunk helper from @escaping @callee_guaranteed (@owned __C.YapDatabaseReadTransaction) -> () to @escaping @callee_unowned @convention(block) (@unowned __C.YapDatabaseReadTransaction) -> () (YapDatabaseTransaction+ChatSecure.swift:0)
10  YapDatabase                     0x0000000103590f5c __76-[YapDatabaseConnection asyncReadWithBlock:completionQueue:completionBlock:]_block_invoke (YapDatabaseConnection.m:2222)
11  libdispatch.dylib               0x0000000184734aa0 _dispatch_call_block_and_release + 20
12  libdispatch.dylib               0x0000000184734a60 _dispatch_client_callout + 12
13  libdispatch.dylib               0x000000018473e9b4 _dispatch_queue_serial_drain$VARIANT$mp + 604
14  libdispatch.dylib               0x000000018473f2fc _dispatch_queue_invoke$VARIANT$mp + 332
15  libdispatch.dylib               0x000000018473fcc8 _dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 336
16  libdispatch.dylib               0x0000000184748098 _dispatch_workloop_worker_thread$VARIANT$mp + 664
17  libsystem_pthread.dylib         0x0000000184a67e70 _pthread_wqthread + 856

chrisballinger avatar Jul 14 '18 15:07 chrisballinger

This crash is still happening in v4.3.3, but in a different place.

Thread 9 Crashed:
0   libswiftCore.dylib              0x0000000102b27a94 0x10286c000 + 2865812 (swift_getObjectType + 60)
1   YapTaskQueue                    0x0000000101fb2c00 reabstraction thunk helper from @escaping @callee_guaranteed (@owned __C.YapDatabaseReadTransaction, @owned Swift.String, @owned Swift.String, @owned Swift.String, @in Any, @owned Swift.String, @owned Swift.String, @in Any) -> (@unowned __C_Synthesized.ComparisonResult) to @escaping @callee_unowned @convention(block) (@unowned __C.YapDatabaseReadTransaction, @unowned __C.NSString, @unowned __C.NSString, @unowned __C.NSString, @unowned Swift.AnyObject, @unowned __C.NSString, @unowned __C.NSString, @unowned Swift.AnyObject) -> (@unowned __C_Synthesized.ComparisonResult) (YapTaskQueueMasterBroker.swift:0)
2   YapTaskQueue                    0x0000000101fb2c00 reabstraction thunk helper from @escaping @callee_guaranteed (@owned __C.YapDatabaseReadTransaction, @owned Swift.String, @owned Swift.String, @owned Swift.String, @in Any, @owned Swift.String, @owned Swift.String, @in Any) -> (@unowned __C_Synthesized.ComparisonResult) to @escaping @callee_unowned @convention(block) (@unowned __C.YapDatabaseReadTransaction, @unowned __C.NSString, @unowned __C.NSString, @unowned __C.NSString, @unowned Swift.AnyObject, @unowned __C.NSString, @unowned __C.NSString, @unowned Swift.AnyObject) -> (@unowned __C_Synthesized.ComparisonResult) (YapTaskQueueMasterBroker.swift:0)
3   YapDatabase                     0x0000000101d51614 __102-[YapDatabaseAutoViewTransaction insertRowid:collectionKey:object:metadata:inGroup:withChanges:isNew:]_block_invoke (YapDatabaseAutoViewTransaction.m:0)
4   YapDatabase                     0x0000000101d51154 -[YapDatabaseAutoViewTransaction insertRowid:collectionKey:object:metadata:inGroup:withChanges:isNew:] (YapDatabaseAutoViewTransaction.m:706)
5   YapDatabase                     0x0000000101d51da0 -[YapDatabaseAutoViewTransaction _handleChangeWithRowid:collectionKey:object:metadata:grouping:sorting:blockInvokeBitMask:changesBitMask:isInsert:] (YapDatabaseAutoViewTransaction.m:878)
6   YapDatabase                     0x0000000101d51ec4 -[YapDatabaseAutoViewTransaction didInsertObject:forCollectionKey:withMetadata:rowid:] (YapDatabaseAutoViewTransaction.m:910)
7   YapDatabase                     0x0000000101df49fc -[YapDatabaseReadWriteTransaction setObject:forKey:inCollection:withMetadata:serializedObject:serializedMetadata:] (YapDatabaseTransaction.m:0)
8   YapDatabase                     0x0000000101df3cd8 -[YapDatabaseReadWriteTransaction setObject:forKey:inCollection:withMetadata:] (YapDatabaseTransaction.m:4680)
9   ChatSecureCore                  0x00000001021ceaf8 -[OTRYapDatabaseObject saveWithTransaction:] (OTRYapDatabaseObject.m:32)
10  ChatSecureCore                  0x00000001021efca0 __34-[OTRXMPPManager enqueueMessages:]_block_invoke_2 (OTRXMPPManager.m:593)
11  CoreFoundation                  0x0000000182de3f38 -[__NSSingleObjectArrayI enumerateObjectsWithOptions:usingBlock:] + 72
12  ChatSecureCore                  0x00000001021efbd0 __34-[OTRXMPPManager enqueueMessages:]_block_invoke (OTRXMPPManager.m:583)
13  YapDatabase                     0x0000000101d89408 __81-[YapDatabaseConnection asyncReadWriteWithBlock:completionQueue:completionBlock:]_block_invoke_2 (YapDatabaseConnection.m:2335)
14  libdispatch.dylib               0x000000018273cae4 _dispatch_client_callout + 12
15  libdispatch.dylib               0x0000000182745640 _dispatch_queue_barrier_sync_invoke_and_complete + 52
16  YapDatabase                     0x0000000101d8933c __81-[YapDatabaseConnection asyncReadWriteWithBlock:completionQueue:completionBlock:]_block_invoke (YapDatabaseConnection.m:2330)
17  libdispatch.dylib               0x000000018273cb24 _dispatch_call_block_and_release + 20
18  libdispatch.dylib               0x000000018273cae4 _dispatch_client_callout + 12
19  libdispatch.dylib               0x0000000182746a38 _dispatch_queue_serial_drain$VARIANT$mp + 604
20  libdispatch.dylib               0x0000000182747380 _dispatch_queue_invoke$VARIANT$mp + 332
21  libdispatch.dylib               0x0000000182747d4c _dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 336
22  libdispatch.dylib               0x000000018275011c _dispatch_workloop_worker_thread$VARIANT$mp + 664
23  libsystem_pthread.dylib         0x0000000182a6fe70 _pthread_wqthread + 856

chrisballinger avatar Jul 15 '18 19:07 chrisballinger

Maybe downgrading to Xcode 9.3 would help produce a build unaffected by this problem? Started having this issue today all of a sudden, the app has rendered completely unusable.

stigger avatar Jul 17 '18 22:07 stigger

@stigger Supposedly it was introduced with Xcode 9.3, so I made a build with Xcode 9.2 that I'll push to TestFlight.

chrisballinger avatar Jul 18 '18 03:07 chrisballinger

Thanks, that resolved the problem for me!

stigger avatar Jul 18 '18 18:07 stigger

@stigger Great! I'll push it out to the App Store

chrisballinger avatar Jul 19 '18 01:07 chrisballinger

We observed that when we uncommented resumeDownloads() method and compiled with Xcode 11.5. The application is still crashing when trying to resume download for unfinished media items. @stigger or @chrisballinger are you still facing this issue or have you guys fixed it in the latest build. Can you provide us suggestions. Below is the crash whioch we are getting 👍

Application Specific Information:

884b4b7e502b4e991677b53971277adfaf0a04a284f8e483e2553d0f8315alt1 > database corruption > database2 >

Attempted to dereference garbage pointer 0x30.

Thread 1 Crashed:

0 ChatSecure 0x202e2dc7c sqlite3VdbeExec

1 ChatSecure 0x202e0df74 sqlite3_step

2 ChatSecure 0x2030d45ac -[YapDatabaseReadTransaction objectForKey:inCollection:]

3 ChatSecure 0x203218b08 -[OTRMediaItem parentObjectWithTransaction:]

4 ChatSecure 0x2034a84e0 block_destroy_helper.310

5 ChatSecure 0x202af6b84 block_destroy_helper.40

6 libdispatch.dylib 0x3102919a8

7 libdispatch.dylib 0x310292524

8 libdispatch.dylib 0x31026fb3c

9 libdispatch.dylib 0x31027054c

10 libdispatch.dylib 0x31027984c

11 libsystem_pthread.dylib 0x3301efb74 _pthread_wqthread

Anupam824 avatar Sep 02 '20 20:09 Anupam824