Details
Description
There are a few users reporting the same issue that they experience multiple crashes in the query when the query is released. All of them said that they don't close the database in their application either. Currently, they don't have reproducible steps and mostly the issue happens to their end-users.
As this happens to multiple users, I think we should at least review the issue and code from our side.
Issue: https://github.com/couchbase/couchbase-lite-ios/issues/2781
Crash Log: https://pastebin.com/raw/dBwFGR4d
Exception : EXC_BAD_ACCESS KERN_INVALID_ADDRESS
Forum Post: https://forums.couchbase.com/t/c4error-code-2-ios-application-crash/29921/5
Attachments
Issue Links
- relates to
-
CBL-2012 20% - Sprint 49
-
- Closed
-
From the crash log, I think the problem is about concurrent calls to DataFile::registerQuery() and DataFile::unregisterQuery(). Currently, we lock when creating c4query and when releasing c4query so those two operations should be fine. I'm suspecting that we will need to lock when releasing the query's enumerator (https://github.com/couchbase/couchbase-lite-ios/blob/master/Objective-C/CBLQueryResultSet.mm#L46) as well as the C4QueryEnumeratorImpl also retains the Query object.