Hello,
We are currently observing some odd behaviour with our application using CBLite and Sync Gateway.
The application is built around client server synchronization. The server creates a form document which is synced to the client. The client can then (potentially offline) fill in the form and submit it for processing by the server. This submission is done by modifying the status of the document from status “draft” to status “outbox”. The server monitors the channel of all documents in the “outbox” status and deletes them after processing. The clients are using CBLite (1.1.1 for iOS and 1.3 for Android) and the server communicates throught the Sync Gateway 1.5 REST service directly.
What we are observing is that once the document has been deleted by the server, Couchbase Lite on the client is once again starting to transfer old revisions of the document eventually leading to a secondary processing on the server (and sometimes even more than 2 times).
The logs of Sync Gateway show the following trace for a problematic form:
We also dit some capturing of the network traffic and I have extracted all individual requests between Sync Gateway and the client / server:
Dropbox - Error - Simplify your life (sensitive information has obviously been redacted)
Unfortunately we are running 2 reverse proxies so it’s a it tedious to determine the exact order of requests. What we can guarantee is that all requests per reverse proxy are in the order received.
Some peculiarities we observed ourselves:
i00/02 => Device immediately PUTs revision 21 in status outbox without ever putting any intermediate revision (as far as we know).
We assume this may be because the device had been offline for a long time.
i00/05 => Device requests both revision 1 and 22 in the bulk_get call. Why?
i00/06 => Device is PUTing revision 2 again and SG accepts it without issue.
i01/14 => Device is once again PUTin revision 21 in outbox status.
We compared the contents of the default.xml attachment in both revision 21s and observed very minimal changes.
We also looked at the document in Couchbase itself and saw the following:
The document seems to contain a several conflicting revisions. We are also not sure how this can be caused as the document is at any time only touched by either the client (status draft) or server (status outbox).
We know that this second part all happened without interaction of the user. After the first processing, the user did not do anything to trigger this again. This all seemed to have happened internally in CBLite so I was wondering if you could provide me with some extra information.
Is this intended behaviour? Is there a way to prevent this?
If there is any additional information I can provide, please let me know.