Push replication works only on startup

Hi,

I’m using CBL:2.1.2, SG:2.1.1, CBS:6.0.0, all community versions. Client - Android, emulator.
I’m trying to use Replicator with ReplicatorType.PUSH_AND_PULL and Continuous mode set to true.
After starting my app I see sync activity, but if after that I’m trying to update documents on client side (with database.save(doc)) I do not see any activity from Replicator (status is not changing and no updates on SG and CBS). But after restart of app I see documents updates on CBS and after start again - no updates.
At the same time if I change documents on CBS side (via SDK) I immediately see updates on client side.
So it looks like that PULL replication is working in Continuous mode as expected, but PUSH is working only on startup.

Thanks

Have you made sure the pushed docs aren’t being rejected by the sync function in Sync Gateway? If they were, you’d be seeing Sync Gateway log messages about it.

Otherwise, logging CB Lite is the best way to diagnose this. If you set Sync logging to verbose, you should see a bunch of log messages with “Pusher” in them – these will give (way too much, and somewhat cryptic) detail about what the push replicator is doing. If there’s nothing in there that you can make sense of, put the logs in a gist and link to it here, and we’ll take a look.

Hi,

Please see attached log from mobile side with verbose level.
Scenario was:

  1. start app, open DB, start push_and_pull continuous replicator
  2. change document (counter_doc) on CBS via SDK, verify updated doc on mobile
  3. change document on mobile - but there is no updates on GW/Server sides
  4. restart replication - verify that updates from step 3 were pushed to server

Can’t see anything useful in logs - when I changed document on mobile there is nothing from CBLite logs.
Timeline:
01-12 20:06:15.714 - I changed document on CBS side and after that there is Pull replication activity on mobile side
01-12 20:06:35.870 and 01-12 20:06:56.267 - I changed document on mobile side (there are logs from DocumentChangeListener callback) but there is no Push replication activity
01-12 20:07:14.742 - I restarted replicator (stop and start) and only after that I can see updated docs on CBS side

link to log

Thanks

This is weird. T es look from the logs as though the local doc update is not triggering the push side of the replicator.

I’ll try to investigate today, if I don’t get called in to jury duty…, :grimacing:

@pasin, @blake.meike — There are some odd things with the (Android) log here — the log level is Verbose, but I see no LiteCore messages beyond Info level; that gets in the way of figuring out what the replicator is doing here.

Also, there are lines in the log that have no timestamp and a four-space indent. I don’t know what makes those different. For instance, about half of the logs from {Repl#1} have timestamps and half don’t…

@jens:

  • The missing timestamp is a bug in Android Studio. A logcat taken with adb, from the CLI, would not have this problem
  • I do see verbose level logs, just not from LiteCore. Logcat would allow that kind of filtering, but it seems unlikely. The problem is more likely in something we are doing as we log…