[cblite 2.8.4] [Android] Replicator Stop after SocketTimeout

Hi

In couchbase lite 2.8.4, the replicator continuous stop after SocketTimeoutException.

com.mapotempo.mapotempo_fleet_android.debug V/CouchbaseLite/NETWORK: AbstractCBLWebSocket{wss://mobile.fleet.beta.mapotempo.com:4984/db/_blipsync}:OkHTTP failed: null
com.mapotempo.mapotempo_fleet_android.debug I/CouchbaseLite/NETWORK: WebSocket CLOSED
    java.net.SocketTimeoutException: sent ping but didn't receive pong within 10000ms (after 2 successful ping/pongs)
        at okhttp3.internal.ws.RealWebSocket.writePingFrame(RealWebSocket.java:545)
        at okhttp3.internal.ws.RealWebSocket$PingRunnable.run(RealWebSocket.java:529)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:307)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:302)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
com.mapotempo.mapotempo_fleet_android.debug E/CouchbaseLite/NETWORK: {N8litecore4repl12C4SocketImplE#6} WebSocket closed abnormally (reason=Unknown error 10)
com.mapotempo.mapotempo_fleet_android.debug I/CouchbaseLite/NETWORK: {N8litecore4repl12C4SocketImplE#6} sent 404 bytes, rcvd 234, in 40.002 sec (10/sec, 6/sec)
com.mapotempo.mapotempo_fleet_android.debug I/CouchbaseLite/NETWORK: {N8litecore4blip10ConnectionE#3} Closed with Unknown error 10: unexpected exception
com.mapotempo.mapotempo_fleet_android.debug I/CouchbaseLite/REPLICATOR: {Repl#4} Connection closed with Unknown error 10: "unexpected exception" (state=2)
com.mapotempo.mapotempo_fleet_android.debug E/CouchbaseLite/REPLICATOR: {Repl#4} Got LiteCore error: LiteCore error 26 "unexpected exception"
com.mapotempo.mapotempo_fleet_android.debug V/CouchbaseLite/REPLICATOR: {Repl#4} progress +0/+0, 0 docs -- now 0 / 0, 0 docs
com.mapotempo.mapotempo_fleet_android.debug I/CouchbaseLite/REPLICATOR: {Repl#4} activityLevel=stopped: connectionState=-1
com.mapotempo.mapotempo_fleet_android.debug I/CouchbaseLite/REPLICATOR: {Repl#4} now stopped
com.mapotempo.mapotempo_fleet_android.debug I/CouchbaseLite/REPLICATOR: {N8litecore4repl6PullerE#10} activityLevel=stopped: pendingResponseCount=0, _caughtUp=1, _pendingRevMessages=0, _activeIncomingRevs=0, _waitingChangesMessages=0, _waitingRevMessages=0, _unfinishedIncomingRevs=0
com.mapotempo.mapotempo_fleet_android.debug V/CouchbaseLite/REPLICATOR: {N8litecore4repl6PullerE#10} now stopped
com.mapotempo.mapotempo_fleet_android.debug I/CouchbaseLite/REPLICATOR: BLIP sent 4 msgs (404 bytes), rcvd 2 msgs (234 bytes) in 40.003 sec. Max outbox depth was 1, avg 1.00

Best regards

There are several possibilities, here:

Most likely is that you are connected through some kind of NAT firewall and that the firewall t is timing out the (websocket) connection.

Also, in an Android app, continuous replication can’t actually be continuous because the application will, eventually, get killed. Better to schedule one-shot replications using the WorkManager.

Finally, this may be related to a know issue, CBL-1841. I believe that that issue has been fixed in our latest release, available soon.

Thank @blake.meike,

I will try soon with Lithium version.
To produce it, I m going to a area with poor connection like stair or with android emulator (the mode airplane don’t close socket).

Best regards.