Hi all,
I found some odd behaviour in the sync gateway. So this is a dev config, Couchbase DB and SG both run on a windows dev machine and all traffic routed to the SG via a reverse proxy. All clients of the SG are mobile devices (currently iOS only).
For some reason the connection SG has to Couchbase DB is dropped randomly (which is not itself the issue) and the SG correctly reports that it will attempt to reconnect:
_time=2016-12-09T19:22:45.983+00:00 _level=INFO _msg=go-couchbase: TAP connection lost; reconnecting to bucket "ketodiet" in 1s
However, while it’s ‘offline’ it keeps processing requests which of course fail, here’s an example:
2016-12-09T19:22:46.385Z HTTP: #40902: GET /ketodiet/CM_8780ACDBEFB743178D79A10EAC4079FC?rev=2-53c9c70ab79a019d708c8fee093f39b4&revs=true&attachments=true
2016-12-09T19:22:46.385Z HTTP: #40902: --> 401 Invalid login (3.0 ms)
2016-12-09T19:22:46.385Z HTTP auth failed for username="18844"
Eventually it reconnects and syncing appears to resume as expected
_time=2016-12-09T19:22:48.588+00:00 _level=INFO _msg=Got new configuration for bucket ketodiet
2016-12-09T19:22:50.519Z HTTP: #40910: GET /ketodiet/CBM_34720f88-4174-403a-916d-5e6a8ef116b5?rev=2-dfa047650b3ea31648c400bfb663e00a&revs=true&attachments=true (as 18844)
The problem is that for whatever reason, changes are not sent down to mobile devices until the SG is restarted. So making changes on a mobile device will PUT documents correctly but the changes are never triggered/ sent to other connected devices. Restarting the SG fixes that.
Any idea what is going on? Is this a known issue? Are there any workarounds?
At the moment I’m thinking of handling 401s on our reverse proxy and re-trying the requests.
Thank you