Close database might hang waiting for no active replicators or live queries

Description

I have found this issue as testDeleteWithActiveReplicationsAndURLEndpointListener was hanged on Jenkins. I couldn't reproduce the issue locally but after reviewing the code, I think the problem can be described as below.

In CBLDatabase's removeActiveStoppable: method, _closeCondition was notified without locking. So there could be a race condition with when _closeCondition is waiting for the broadcard signals and cause _closeCondition to wait forever.

Activity

Show:

CB robot February 14, 2024 at 8:01 PM

Build couchbase-lite-ios-3.1.6-2 contains couchbase-lite-ios commit 3c30fa8 with commit message:
https://couchbasecloud.atlassian.net/browse/CBL-5077#icft=CBL-5077 : Fix close database could hang waiting for active components to close (#3227)

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Story Points

Components

Sprint

Fix versions

Affects versions

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created November 14, 2023 at 8:58 PM
Updated August 31, 2024 at 10:55 AM
Resolved February 14, 2024 at 5:37 PM
Instabug