Sync gateway stops working, requires restart

I am running Sync Gateway Community Edition 2.7.1 on a Centos 7 machine.

The gateway seems to be running fine and all of the applications are able to sync with it for long periods of time. Then randomly the applications fail to complete the sync but do not enter an error phase of the sync process. In other words the sync doesn’t fail but there is also no data throughput.

On the sg_info.log I can see that the device made contact with the gateway but the sync does not complete, i.e. the data from the application is not sent to the Couchbase server and vice versa.

There are no messages in either the sg_error.log or sg_info.log files that give any indication to what happened and what is wrong.

After restarting the gateway everything works as it should and the applications are able to continue syncing.

Has anyone else come across something similar happening to their gateways? Please advise?

I haven’t seen that issue. Some followup questions:

  • Is your Sync Gateway otherwise responsive? e.g. are you able to make calls to the REST API?
  • Is there any diagnostic information in your client logs?
  • Does fully closing and restarting the client application have any effect?

Hi, thanks for coming back to me!

  1. Yes otherwise it’s fully responsive and I can interact via the REST API.
  2. I have implemented remote logging so I can view sync errors. I will let you know if there are any updates in this regard.
  3. No it does not have an effect.

I am aware that this information is very limited so I will update this thread if I get any more information on my side.

Thanks again!

I’ve seen the same issue and I believe it’s because of some sync gateway session timeout with couchbase. I’ve noticed that as long as sync gateway “touches” couchbase at least once in about 24 hours, I don’t have the issue.

I’m not sure if there’s any documentation around this, but it’s probably by design. I’m not sure if there’s any monitoring available to alert when this issue occurs.

Not sure what version of sync gateway and server you are using but that behavior is not by design. There is no requirement for the app to implement logic to explicitly have the Sync Gateway to “touch” couchbase server. There is a built-in keepalive mechanism in place that keeps the connection between sync gateway and server open.
I don’t know what the the default period and that may likely vary by OS but you can configure that

CC @bbrks

Perhaps it’s a keep-alive configuration. My OS is set to the following:
keep alive time = 7200
keep alive interval = 75
keep alive probes = 9
So I don’t think that would explain this issue.

I haven’t tried configuring keep alive in the config file yet.

I’m using couchbase/sync-gateway:2.6.0-community and couchbase:community (6.0.0 build 1693) in docker containers.

Next time you encounter the issue, please share the debug sync gateway logs

I am getting exactly this issue,
I’m using couchbase:community-7.2.0 and couchbase/sync-gateway:3.1.0-community.
The sync works nicely but after a while, it can be 24 hours or weeks, but then it just stops synching. What’s special is that the gateway rest api is working, so I can create and retrieve documents.
I will enable the debug logs and send the logs here, I just want to mention that the issue is still there,

restarting the docker-compose always works (I was always doing both the server and gateway)