Sync between device(couchbase lite), sync gateway, couchbase server is not working properly

if I add data to my device it is getting reflected on sync gateway and couchbase server but when I add or delete document on the couchbase server only the sync gateway pulls it, the device doesn’t pull it. If I restart the device it works fine but when I come back next daay the functioning stops working. I am using Couchbase Enterprise edition 6.6.0(current)

Error.log file

2020-11-24T10:33:26.932+05:30 [ERR] c:#054 #054: [12008] Error performing bulk get operation - cause: {​​​​​​​1 errors, starting with MCResponse status=TMPFAIL, opcode=SUBDOC_MULTI_LOOKUP, opaque=1, msg: }​​​​​​​ – rest.(*handler).writeError() at handler.go:724
2020-11-24T10:33:31.985+05:30 [ERR] c:#068 #068: [12008] Error performing bulk get operation - cause: {​​​​​​​1 errors, starting with MCResponse status=TMPFAIL, opcode=SUBDOC_MULTI_LOOKUP, opaque=1, msg: }​​​​​​​ – rest.(*handler).writeError() at handler.go:724
2020-11-24T11:35:29.001+05:30 [ERR] c:#346 #346: [12008] Error performing bulk get operation - cause: {​​​​​​​1 errors, starting with MCResponse status=TMPFAIL, opcode=SUBDOC_MULTI_LOOKUP, opaque=1, msg: }​​​​​​​ – rest.(*handler).writeError() at handler.go:724
2020-11-24T11:35:32.638+05:30 [ERR] c:#357 #357: [12008] Error performing bulk get operation - cause: {​​​​​​​1 errors, starting with MCResponse status=TMPFAIL, opcode=SUBDOC_MULTI_LOOKUP, opaque=1, msg: }​​​​​​​ – rest.(*handler).writeError() at handler.go:724
2020-11-25T10:50:19.431+05:30 [ERR] gocb: memdClient read failure: EOF – base.GoCBCoreLogger.Log() at logger_external.go:66
2020-11-25T10:50:19.056+05:30 [ERR] gocb: memdClient read failure: read tcp 10.55.18.1:62835->10.55.18.1:11210: wsarecv: An existing connection was forcibly closed by the remote host. – base.GoCBCoreLogger.Log() at logger_external.go:66
2020-11-25T10:50:26.910+05:30 [ERR] gocb: memdClient read failure: read tcp 10.55.18.1:64747->10.55.18.1:11210: wsarecv: An existing connection was forcibly closed by the remote host. – base.GoCBCoreLogger.Log() at logger_external.go:66
2020-11-25T10:51:43.822+05:30 ==== Couchbase Sync Gateway/2.7.3(3;33d352f) CE ====
2020-11-25T10:51:44.551+05:30 ==== Couchbase Sync Gateway/2.7.3(3;33d352f) CE ====
2020-11-25T10:53:30.225+05:30 [ERR] Error opening database grocery-sync: 502 Unable to connect to Couchbase Server (connection refused). Please ensure it is running and reachable at the configured host and port. Detailed error: failed to connect to any of the specified hosts – rest.RunServer() at config.go:1028
2020-11-25T11:35:40.164+05:30 ==== Couchbase Sync Gateway/2.7.3(3;33d352f) CE ====
2020-11-25T11:35:40.170+05:30 ==== Couchbase Sync Gateway/2.7.3(3;33d352f) CE ====
2020-11-25T13:39:46.758+05:30 ==== Couchbase Sync Gateway/2.7.3(3;33d352f) CE ====
2020-11-25T13:39:46.767+05:30 ==== Couchbase Sync Gateway/2.7.3(3;33d352f) CE ====
2020-11-25T13:39:47.682+05:30 [ERR] Error opening database grocery-sync: Backing Couchbase Server bucket has a non-zero MaxTTL value: 120. Please set MaxTTL to 0 in Couchbase Server Admin UI and try again. – rest.RunServer() at config.go:1028
2020-11-25T13:49:03.636+05:30 [ERR] gocb: memdClient read failure: EOF – base.GoCBCoreLogger.Log() at logger_external.go:66
2020-11-25T13:49:03.638+05:30 [ERR] gocb: memdClient read failure: EOF – base.GoCBCoreLogger.Log() at logger_external.go:66
2020-11-25T13:49:04.614+05:30 [ERR] gocb: memdClient read failure: read tcp 10.55.18.1:61184->10.55.18.1:11210: wsarecv: An existing connection was forcibly closed by the remote host. – base.GoCBCoreLogger.Log() at logger_external.go:66
2020-11-25T13:49:04.613+05:30 [ERR] gocb: memdClient read failure: read tcp 10.55.18.1:61183->10.55.18.1:11210: wsarecv: An existing connection was forcibly closed by the remote host. – base.GoCBCoreLogger.Log() at logger_external.go:66
2020-11-25T13:50:15.206+05:30 ==== Couchbase Sync Gateway/2.7.3(3;33d352f) CE ====
2020-11-25T13:50:15.644+05:30 ==== Couchbase Sync Gateway/2.7.3(3;33d352f) CE ====
2020-11-25T13:51:57.106+05:30 [ERR] Error opening database grocery-sync: 502 Unable to connect to Couchbase Server (connection refused). Please ensure it is running and reachable at the configured host and port. Detailed error: failed to connect to any of the specified hosts – rest.RunServer() at config.go:1028

Please help me .

From error it’s quite apparent that the Sync Gateway is unable to connect to the server . As suggested in error message, start with confirming the server setup and ensuring that it’s reachable . I cant see why restarting the couchbase lite would have any effect on this but I would start with addressing the sync gateway - server connection issues and we can follow up with client sync issues.

I checked everything and the setup seems fine Adding a document from the couchbase lite device syncs with the sync gateway and the couchbase server but when the same document is edited on the couchbase server it is showing changes only on sync gateway. the device doesn’t reflect the changes. getting this error.

2020-11-27T16:31:08.387+05:30 [INF] HTTP: #453: POST /grocery-sync/_bulk_docs (as ADMIN)
2020-11-27T16:31:08.388+05:30 [INF] BulkDocs: Doc “cc58e80b-b6b0-4cff-8330-a4f0e5c8d54a” → 409 Document revision conflict (409 Document revision conflict)
2020-11-27T16:31:08.388+05:30 [INF] HTTP+: #453: → 201 (1.0 ms)

_bulk_docs is a write operation, not a read operation, so I don’t think the error above is relevant to the ‘device doesn’t reflect the changes’ issue.

A common issue when Couchbase Lite can write but not read documents is the security access of the Couchbase Lite user. I’d suggest verifying that they have read access to the document you’re writing to the server - the https://docs.couchbase.com/sync-gateway/current/learn/read-access.html documentation might be helpful here.

I did the whole setup again on a fresh machine but I am not sure as to what is hapenning. There seems some problem with the TTL logic. In my couchbase server when I enable TTL (I have set it to 60 seconds) the sync gateway sends the below error. It also stops the sync gateway and doesn’t allow to start the service (from servicer in Windows),

2020-11-29T16:34:04.037+05:30 [ERR] Error opening database grocery-sync: Backing Couchbase Server bucket has a non-zero MaxTTL value: 60. Please set MaxTTL to 0 in Couchbase Server Admin UI and try again. – rest.RunServer() at config.go:1079