Sync Gateway stopped sending changes

Hi,
I’ve hit an issue so that Sync Gateway stopped sending changes after adding more data into the db when initial data was sent.
I am using _changes?feed=continuous on the gateway, connected to the Couchbase Server v. 5.1.0.

I’ve loaded ~25k documents into a bucket.
After that I’ve tested the sync gateway by calling _changes?feed=continuous.
The gateway sent all the data till the end of the bucket and after that it was still sending data properly when triggered via adding/modifying/removing documents. I was receiving new data using curl with _changes API and I was seeing in sync_gateway_error.log logs like the one below:
[INF] Changes: sending 1 change(s)

Then I’ve loaded another ~50k elements into the bucket.
After this Gateway I invoked again the rest API _changes?feed=continuous.
Gateway sent all the initial data from the bucket but somehow became kind of out of sync in the matter of sending the changes.
I can see in the logs that the Gateway notifies about the changes but it does not send them:

2019-06-14T06:34:23.663-05:00 [INF] Import: Created new rev ID 2-afb7bda1b2282c0ec2ffe8ae443ec307
2019-06-14T06:34:23.664-05:00 [INF] CRUD: Stored doc “17491.0.100001” / “2-afb7bda1b2282c0ec2ffe8ae443ec307”
2019-06-14T06:34:23.665-05:00 [INF] Cache: Received #23357 after 0ms (“17491.0.100001” / “2-afb7bda1b2282c0ec2ffe8ae443ec307”)

I’ve noticed also strange seq ids in the responses, after around 75k it became 373k:
{“seq”:75344,“id”:“17491.0.325910”,“changes”:[{“rev”:“1-cf607e654ce663af48174270d41032dc”}]}
{“seq”:75348,“id”:“17491.0.306944”,“changes”:[{“rev”:“4-ab227cb480d3912460c3c77f68e278b0”}]}
{“seq”:373659,“id”:“17491.0.325454”,“changes”:[{“rev”:“3-3b6e6124b7202bde24ce426803a45f5b”}]}
{“seq”:373660,“id”:“17491.0.312266”,“changes”:[{“rev”:“3-332f99419f3ef5e392e4b7b2c1718cfa”}]}
{“seq”:373661,“id”:“17491.0.317883”,“changes”:[{“rev”:“3-9eca51dbd8846fbf9a0351125dd27138”}]}

Is there any chance that the sync gateway lost the seq id that it should track?
Is there any way to refresh it?

Restart of the sync gateway solves the issue and it starts syncing the data correctly.

Regards,
hch

It turned out that there was additional action made apart of adding new docs.
Flushing the bucket via web interface makes the SyncGateway out of sync.