Multiple Buckets, Multiple Replicator objects error

Hi,

CBL 2.0 beta
SGW 2.0 beta
CBServer 5.1

We have different different buckets. So we make different Replicator objects. But when we start all of them together it seems to stress the application too much and our android app crashes. Is there a way to run them sequential. That’s to say: if the replication of one bucket is finished the next one starts?

thanks
Thomas

Hi Thomas,

Are you talking about the first time an app starts and syncs, or is this an issue every time? Also, how many buckets are you using? As a rough guideline with Couchbase Server you don’t want to have more than 10 or so buckets. (That’s a Couchbase Server constraint, not a Couchbase Lite/Sync Gateway one.)

One approach we often recommend is to do one-shot replications for the initial sync, and then switching to continuous. With that approach, you would have control over the sequence. There’s no way to automatically order continuous replications right now.

Another possible approach might be to build your own sort of triggering system. For example, if you have push notifications in your app, you can use that as a way to send a notification of when replication is needed. You could do this with a dedicated control document, too.

1 Like

Thanks @hod.greeley for your response

Sorry if I didn’t give enough info.

We have aprox 8 buckets. Some of wich have a small number of documents (10 or 400) with others bigger (100 000 to 250 000).

I’m currently talking about the initial, first time app start sync when CBL databases are empty. We create every Replicator object (not-continuous, pull-only) per database and just Start() them. After a few seconds, the app crashes without warning, error or even an App has stopped working notice.

I have the Database.SetLogLevel(LogDomain.Replicator, Couchbase.Lite.Logging.LogLevel.Verbose); set but don’t really know where to physically search on the android device for it. It’s not in the app-folder.

Currently, and I really don’t know if this is the right approach, I’m about to test the following: I made wrapper with the db names as parameter where I add the following in the AddChangeListener:

  if (!replication.Config.Continuous && args.Status.Activity == ReplicatorActivityLevel.Stopped && args.Status.Progress.Completed == args.Status.Progress.Total)
                {
                    if (_progress)
                    progressDialog.Hide();
                    if (replicationConfig.Continuous == false)
                    {
                        this.Stop();
                        Task.Delay(1000).Wait();
                        _current++;
                        if (_current != total-1)
                        {
                            this.prepare(_dbs[_current]);
                            this.Start(_replicatorType);
                        }
                    }
                }

But again, I don’t really know if this will be the right approach. Sometimes the Total count just reaches a 1000 where it is a bucket of 112 000.

And yes, after the initial replication I would like it to be continuous… .

The binary logs should be in the app data directory. You can also turn on logcat logging by calling Couchbase.Lite.Support.Droid.EnableTextLogging()

1 Like

We’d like to see the logs when you get them. Shouldn’t be crashing like that. Have you tried narrowing the issue down? Knowing as many details (minimum number of replications where the crash happens, bucket details) would be very helpful.

I think you’re doing something a little different than I would suggest. Take a look at this post and see if it helps: https://blog.couchbase.com/determining-status-replication-couchbase-lite/

1 Like

I’ll keep it in mind. Just fighting with SGW. If the problem keeps getting up I’ll send the logs.

The link that @hod.greeley pointed is for 1.x version. Please refer to this doc for description of replication status codes for 2.0

Is it still the case ? It should be in the default app data location as Jim pointed out.

Hi all,

I got a
LiteCoreException (1006): connection closed abnormally in the vs debug

CouchbaseLite [30] 2018-2-15 03:52:21.619+01:00 Sync {Repl#378} Got LiteCore error: connection closed abnormally (7/1006) in the logcat

I really can’t seem to find the log-file. Maybe because the device is not rooted?

update:
Research hints me to websockets. I don’t think it is due to the server. I run SignalR on it and that works perfectly… .

sorry if I missed this - so you are creating 8 replicator instances right? And issue does not happen with a single replicator instance right?

Logs are written to logcat. Have you enabled sync logging via the API?

This is Xamarin Android, and logs are not written to logcat by default. The only thing on by default is the binary logger.

Yes indeed priya. I must say, the replications I begin with are of buckets with small amount of items. I will try a big one at work this morning and check if it holds as one instance. I’ll post the results here

UPDATE: replication of bucket with big amount of data (100 000+) also crashes

Can you guys give a quick c# .NET example of how you would code a run of multiple replication instances as sequential as possible? I’ll then check if I still have the error. Maybe my conceptualisation is just wrong?

For the crash related to pulling a single bucket of 100,000+ documents, can you please you share the crash log .
Or is it the same websocket error you observed for multiple replication instances?

Hi @priya.rajagopal

I just recieved the 1005 error. I noted my findings in #967

I think it’s worthy to note that the ‘blank’ crash without any kind of warning always takes place the after the first build.

I use this setup in a blank xamarin cross platform solution

  Database.SetLogLevel(LogDomain.Replicator, Couchbase.Lite.Logging.LogLevel.Verbose);
            database = new Database(DbName);
            database.Delete();
            URLEndpoint urlEndpoint = new URLEndpoint(new Uri(SyncGateWayUri + DbName));

            var replicationConfig = new ReplicatorConfiguration
            (
                new Database(DbName),
                urlEndpoint
            )
            {
                Continuous = true,
                ReplicatorType = ReplicatorType.Pull,
                Authenticator = new BasicAuthenticator(ServerUserName, ServerPassword)
            }
            ;
            ItemReplicator = new Replicator(replicationConfig);
ItemReplicator .Start();