3

I have this structure

Couchbase server <---> couch sync gateway <---> pouchdb

and I have 4 databases every local database is sync to remote and every remote db is sync to local, syncing is live. When I load the page syncing starts, but every second I have a lot of errors in console log

enter image description here

these errors use a lot of memory (my chrome tab uses about 800 Mb of memory after 20 minutes) How can i prevent this? The problem is that in my javascript my config is

var syncOptions = {
    live: true,
    retry: true
};
var localDB = new PouchDB("building");
var remoteDB = new PouchDB("http://xxx.azure.com:4984/building");
localDB.sync(remoteDB, syncOptions);

If I set "retry" value to false there are no problems, but live sync doesn't work, if I set "retry" value to true my page generates about 4 error every second (because I'm syncing 4 databases) What can I do? Thanks

EDIT

I'm using pouchdb-5.4.1.js

Mauro Sala
  • 1,166
  • 2
  • 12
  • 33
  • 1
    They're not really errors; as the message says, PouchDB is just checking for a saved replication checkpoint on the server, and the browser ends up logging an error for the 404 response status when there isn't one. This should only happen on the first replication; after that PouchDB saves a checkpoint and the logs shouldn't happen anymore. This looks like something to do with PouchDB, which I don't know much about (I work on Couchbase Mobile.) – Jens Alfke Jun 13 '16 at 21:42
  • Yeah, I know that aren't really errors, but these "not error" are like thirsty bitch...I have a lot of problem because the app is unusable...is there any good alternative to pouchdb for to sync server-client? Thanks – Mauro Sala Jun 14 '16 at 08:27
  • If you want something that will run in a regular web page, PouchDB is the only option I know of. If you can use an app container like PhoneGap, you can use the Couchbase Lite plugin. – Jens Alfke Jun 15 '16 at 21:27
  • I am using the same configuration (well, only the one database) and I have just updated from PouchDB 4.0.1 to 5.4.4. I now see the same messages continuously every couple of seconds. Previously (on 4.0.1) I would see two or three of these messages when first replicating, then no more. This seems to me to be an error that has crept into PouchDB. I will try some other versions between 4.0.1 and 5.4.4 and see if I can find out when it happens. What version are you using? – giles123 Jun 20 '16 at 13:29
  • I can confirm that (for me at least) this behaviour is different between PouchDB 5.0.0 and 5.1.0. Using 5.0.0 I see a couple of these messages when I first replicate the database, with 5.1.0, I see these messages continuously. – giles123 Jun 20 '16 at 13:39

1 Answers1

1

As the console suggests, these are not errors (I mean, they are, but, that is perfectly normal.) Why this happens is because PouchDB is not officially supported by Couchbase sync Gateway. So, to make it support in an effective manner, PouchDB creates its own milestones on the Couchbase server. Typically you should be seeing a lot of errors on the path "_local", "_bulk_get" and "_all_docs". That is because of problems with integration between Couchbase Sync Gateway and PouchDB. But, you've got nothing to worry about if you've written your sync function properly. It should get the job done, albeit, not as effectively as we want.

mhatch
  • 4,441
  • 6
  • 36
  • 62
Sarvesh Chitko
  • 158
  • 1
  • 9