Q: lite 2.5 -- android client reset and sync error

HI,
my env:
couchbase server 6.0.1
sync_gateway 2.5
couchbase lite 2.5

when the android device is sleep(turn off screen), the lite connection often reset, the sg logs below:

2019-05-10T05:01:51.762Z [INF] HTTP: #074: GET /kitchen/MsgTable.bab2c9ab-239a-476c-9d26-f412d3e598a5 (as 733d2f51)
2019-05-10T05:01:51.766Z [INF] HTTP+: #074: --> 200 (5.2 ms)
2019-05-10T05:01:51.823Z [INF] HTTP: #075: PUT /kitchen/MsgTable.bab2c9ab-239a-476c-9d26-f412d3e598a5 (as 733d2f51)
2019-05-10T05:01:51.835Z [INF] CRUD: c:#075 Stored doc “MsgTable.bab2c9ab-239a-476c-9d26-f412d3e598a5” / “265-b2de29bea8794a3f5122719c390a9fd0” as #89256
2019-05-10T05:01:51.835Z [INF] HTTP+: #075: --> 201 (12.6 ms)
2019-05-10T05:01:51.837Z [INF] Cache: Received #89256 after 7ms (“MsgTable.bab2c9ab-239a-476c-9d26-f412d3e598a5” / “265-b2de29bea8794a3f5122719c390a9fd0”)
2019-05-10T05:01:51.837Z [INF] Cache: #89256 ==> channels {*, 733d2f51}
2019-05-10T05:01:51.837Z [INF] Cache: c:[51c5d887] getCachedChanges(“733d2f51”, 89255) --> 1 changes valid from #89255
2019-05-10T05:01:51.837Z [INF] Cache: c:[401f2019] getCachedChanges(“733d2f51”, 89255) --> 1 changes valid from #89255
2019-05-10T05:01:51.837Z [INF] Cache: c:[1af5e630] getCachedChanges(“733d2f51”, 89255) --> 1 changes valid from #89255
2019-05-10T05:02:08.678Z [INF] WS: c:[1af5e630] Error: receiveLoop exiting with WebSocket error: read tcp 172.19.0.3:4984->58.56.7.218:36122: read: connection timed out
2019-05-10T05:02:08.679Z [INF] WS: c:[1af5e630] BLIP/Websocket Handler exited: read tcp 172.19.0.3:4984->58.56.7.218:36122: read: connection timed out
2019-05-10T05:02:08.679Z [INF] HTTP: c:[1af5e630] #060: --> BLIP+WebSocket connection error: read tcp 172.19.0.3:4984->58.56.7.218:36122: read: connection timed out
2019-05-10T05:02:08.679Z [INF] HTTP: c:[1af5e630] #060: --> BLIP+WebSocket connection closed
2019-05-10T05:02:08.679Z [INF] Sync: c:[1af5e630] Sent 1 changes to client, from seq 89253. User:733d2f51
2019-05-10T05:02:08.679Z [INF] Changes: c:[1af5e630] MultiChangesFeed done (to 733d2f51)
2019-05-10T05:02:08.679Z [ERR] c:[1af5e630] Invalid response to ‘changes’ message: RPY#39 – EOF. Body: , User:733d2f51 – rest.(*blipSyncContext).Logf() at blip_sync.go:224

the android lite replicatior always in BUSY status, can’t sync data.
after about 4 mins, the replicatior become OFFLINE --> CONNECTING–> BUSY, then the data sync with sg.

Best regards!

angular

Hi there, do you have the couchbase lite log for us? The information you provide us is not enough for us to verify the issue.

I don’t think there is much we can do about that. While I’m not sure of exactly what is going on here, when the phone is asleep, the Android OS is going to forcibly disconnect application network connections. That’s how Android works.

HI @Sandy_Chuang @blake.meike,

thanks for your reply. I’ll find a method to keep the application network keepalive.

Best Regards!

angular

You might consider a Foreground Service…