couchbase-lite-core icon indicating copy to clipboard operation
couchbase-lite-core copied to clipboard

Crash when stopping replicator and closing database

Open KraemerDEM opened this issue 3 years ago • 1 comments

I sometimes encounter crashes when exiting my application. These crashes occur when I'm stopping a replicator via C4Replicator::stop, freeing the replicator via c4repl_free and then close the database via C4Database::close. IMHO this happens because stopping a replicator just enqueues a "stop" message and the message may not have been handled when freeing the replicator and/or closing the database. It seems to happen less often if I first close the database and then close the replicator. It doesn't seem to occur if I don't free the replicator at all, but that produces memory leaks. Is there a better way to reliably cleanup and close replicators/databases?

KraemerDEM avatar Aug 05 '22 07:08 KraemerDEM

This seems more like a question than a bug report. I'd encourage the use of the forums for this purpose. However note that you are correct that you need to wait until the replicator is stopped and then free it. You can track it via its change listener, or just by polling its status.

borrrden avatar Aug 08 '22 20:08 borrrden

This issue is getting stale, so this is a 7 day close warning.

borrrden avatar Sep 06 '22 02:09 borrrden

Sorry, I forgot to close this, I fixed it in my code by checking the status...

KraemerDEM avatar Sep 06 '22 05:09 KraemerDEM