Push replication gets stuck in kCBLReplicationIdle status

24 views
Skip to first unread message

David Quon

unread,
Jul 15, 2016, 7:21:13 PM7/15/16
to Couchbase Mobile
We're using the CBL for iOS on branch `release/1.2.2`.  We have a `replicate` method that gets called during initial login as well as periodically based on a timer or if the app is backgrounded and foregrounded.  These are one shot replications and not continuous.

(void)replicate
{
    [self.pullReplication start];
    [self.pushReplication start];
}

The databases for the push and pull replication don't exist yet upon initial login and are created as part of the `self.pullReplication` and `self.pushReplication` method calls similar to below.

- (CBLReplication *)pullReplication

{

    if (!_pullReplication)

    {

        _pullReplication = [self.database createPullReplication:self.pullReplicationURL];

    }


    return _pullReplication;

}


- (CBLReplication *)pushReplication

{

    if (!_pushReplication)

    {

        _pushReplication = [self.database createPushReplication:self.pushReplicationURL];

    }

    

    return _pushReplication;

}


During the initial login the databases are created properly and the push and pull replication seems to happen successfully watching the logging by enabling `-Log YES`, `-LogSync YES`, and -LogSyncVerbose YES`.  However the next time `replicate` is called after the initial login the logging only shows the pull replication and not the push replication.

Upon further inspection the pull replication `status` is `kCBLReplicationStopped` whereas the push replication `status` is `kCBLReplicationIdle` after the initial login.  If the app is stopped and re-started both pull and push replication statuses are `kCBLReplicationStopped` and both push and pull replications show up properly in the logging.  However there seems to be some sort of race condition during the initial login which causes the push replication to get stuck in the `kCBLReplicationIdle` status.  I just wanted to see if this was expected behavior or potentially a bug in CBL iOS.  Thanks.

Jens Alfke

unread,
Jul 15, 2016, 7:28:26 PM7/15/16
to mobile-c...@googlegroups.com
On Jul 15, 2016, at 4:21 PM, David Quon <dav...@amcoonline.net> wrote:

Upon further inspection the pull replication `status` is `kCBLReplicationStopped` whereas the push replication `status` is `kCBLReplicationIdle` after the initial login.

That’s weird; the Idle state should only show up for continuous replications.

Definitely file an issue. Attach logs (saved as a gist or something like that.)

—Jens

David Quon

unread,
Jul 15, 2016, 7:38:48 PM7/15/16
to Couchbase Mobile
> That’s weird; the Idle state should only show up for continuous replications.

That's what I was thinking as well.  I'll file an issue but I might send the logs to you as a private gists as it has some proprietary URL information (and might take too long to clean up).  Let me know if you'd prefer something different.  Thanks for your help as always Jens.

David Quon

unread,
Jul 15, 2016, 8:38:57 PM7/15/16
to Couchbase Mobile
Reply all
Reply to author
Forward
0 new messages