Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-1495

Replicator is stuck in "connecting" state: Root cause

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.8.1
    • 2.8.4
    • Java, Java-Android
    • Security Level: Public
    • None
    • Blake 36, Blake 37
    • 3

    Description

      Copied from https://github.com/couchbase/couchbase-lite-java-ce-root/issues/13 :

      A AbstractCBLWebSocket object is constructed with webSocket member var to be null, and it is not set until onOpen event listener is called when websocket handshake finishes (after the tcp connection establishes).
      Couchbase lite core handles connection timeout (with a default value of 15), and it will eventually call AbstractCBLWebSocket.requestClose method to close it on timeout is detected.
      Look at first several lines of this method, AbstractCBLWebSocket.requestClose, there's a shortcut return if webSocket is null, which is true when connection timeout happens. Okhttp know nothing about the request to close, it will keep trying (and retry) to connect.
      And okhttp timeouts are explicitly set to 0 (because core would take charge), so it hangs for a very long time, maybe forever, even if the bad network recovers. Replicator is stuck in "connecting" state if we check from outside (sometimes "busy").
      okhttp sometimes decides to stop and raise an exception in time, luckily, onFailure is called and end all this. (So we can know the failure from outside and restart replication)
      There's another possibility that handshake finally succeeds after the core decide to close it because of timeout. I'm not sure what will happen then.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            blake.meike Blake Meike created issue -
            blake.meike Blake Meike made changes -
            Field Original Value New Value
            Link This issue relates to CBL-1481 [ CBL-1481 ]
            daniel.petersen Daniel Petersen made changes -
            Assignee The Lite [ cbgto ] Blake Meike [ blake.meike ]
            daniel.petersen Daniel Petersen made changes -
            Sprint Blake 36 [ 1360 ]
            daniel.petersen Daniel Petersen made changes -
            Rank Ranked higher
            blake.meike Blake Meike made changes -
            Summary Replicator is stuck in "connecting" state Replicator is stuck in "connecting" state: Root cause
            daniel.petersen Daniel Petersen made changes -
            Sprint Blake 36 [ 1360 ] Blake 36, Sandy 38 [ 1360, 1380 ]
            blake.meike Blake Meike added a comment -

            fixed in couchbase-lite-java-common @ d2413f29730b1d9a4544244f

            blake.meike Blake Meike added a comment - fixed in couchbase-lite-java-common @ d2413f29730b1d9a4544244f
            blake.meike Blake Meike made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]
            blake.meike Blake Meike made changes -
            Status Resolved [ 5 ] Closed [ 6 ]
            blake.meike Blake Meike made changes -
            Link This issue relates to CBL-1527 [ CBL-1527 ]
            blake.meike Blake Meike added a comment -

            Re-open these issues until they are fixed in the hydrogen branch, for 2.8.x

            blake.meike Blake Meike added a comment - Re-open these issues until they are fixed in the hydrogen branch, for 2.8.x
            blake.meike Blake Meike made changes -
            Resolution Fixed [ 1 ]
            Status Closed [ 6 ] Reopened [ 4 ]
            blake.meike Blake Meike made changes -
            Resolution Fixed [ 1 ]
            Status Reopened [ 4 ] Resolved [ 5 ]
            blake.meike Blake Meike added a comment -

            Fixed in couchbase-lite-java-common @ 10c53746c3fae9a19d6aaf6d

            blake.meike Blake Meike added a comment - Fixed in couchbase-lite-java-common @ 10c53746c3fae9a19d6aaf6d
            blake.meike Blake Meike made changes -
            Status Resolved [ 5 ] Closed [ 6 ]
            lynn.straus Lynn Straus made changes -
            Link This issue blocks MB-42938 [ MB-42938 ]

            People

              blake.meike Blake Meike
              blake.meike Blake Meike
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty