Couchbase Lite Enterprise 2.5.0 (for .NET) does not replicate with Sync Gateway

Hi,

First of all let me congratulate you on such a great product. Looking forward to use it in my next project.

I have the following playing ground environment:

  1. .NET Core Console application using Couchbase Lite Enterprise 2.5.0 on computer 1. This console application is based on: https://docs.couchbase.com/couchbase-lite/2.5/csharp.html

  2. Latest version of Sync Gateway Enterprise running in computer 2. SG ist configured according to: https://docs.couchbase.com/sync-gateway/2.5/getting-started.html#installation

  3. Latest version of Couchbase Server enterprise running on computer 3

  4. All three computers are inside a private development domain.

Problem:
My console application cannot replicate with the Sync Gateway on computer 2. I get the following warning/errors:

[Database] (Status) [8] No mapping for OperationCanceledException; interpreting as ‘UnexpectedError’
[Network] {C4SocketImpl#1}==> class litecore::repl::C4SocketImpl ws://2.148.48.235:4985/plappdb/_blipsync @0000000544077820

[Network] {C4SocketImpl#1} Unexpected or unclean socket disconnect! (reason=Unknown error, code=10)

ERROR) [Replicator] {Repl#2}==> class litecore::repl::Replicator D:\Innovationsprojekte\CouchbaseMobile\CouchbaseLiteConsole\bin\Debug\netcoreapp2.2\CouchbaseLite\plappdb.cblite2\ ->ws://2.148.48.235:4985/plappdb/_blipsync @000000055EDC1A88

ERROR) [Replicator] {Repl#2} Got LiteCore error: LiteCore error 26 “The operation was canceled.”

Configuration
couchbase Lite:
_urlEndpoint = new URLEndpoint(new Uri($“ws://2.148.48.235:4985/plappdb”));
_replicatorConfig = new ReplicatorConfiguration(this._database, _urlEndpoint);
_replicatorConfig.Authenticator = new BasicAuthenticator(“sync_gateway”, “start#123”);
_replicatorConfig.ReplicatorType = ReplicatorType.PushAndPull;
_replicator = new Replicator(_replicatorConfig);
_replicator.AddChangeListener(this.ReplicationEventHandler);

Sync Gateway

{
  "adminInterface": "2.148.48.235:4985",
  "interface": "2.148.48.235:4987",
  "log": ["*"],
  
  "databases": {
    "plappdb": {
      "server": "http://2.148.48.227:8091",
      "bucket": "plapp-bucket",
      "username": "sync_gateway", 
      "password": "start#123", 
      "enable_shared_bucket_access": true, 
      "import_docs": "continuous",
	  "num_index_replicas": 0,
      "users": {
        "GUEST": { "disabled": false, "admin_channels": ["*"] }
      },
      "sync": "function (doc, oldDoc) { if (doc.sdk) { channel(doc.sdk);} }"
    }
  }
}

What did I do wrong? why isn’t the lite client able to connect to the Sync Gateway?

Best Regards,
Faris Ahmed

This error is a bit cryptic but it means that the other side did not respond before the timeout period (basically, the connection timed out when trying to connect). Are you able to reach this server in a browser via http (http://2.148.48.235:4987)? You should be using the “interface” address to connect by the way. Admin will of course work but it’s bad security practice to expose the admin port publicly.

@borrrden If he open it on his private smartphone, how could it expose the admin port publicly? What do you mean by “expose the admin port”? How could the port be exposed?

I mean that his sync gateway configuration shows both the admin port and public port being hosted on the same IP address (see interface and adminInterface). This is usually a bad idea as Sync Gateway is almost always a public facing component. If the public can access the admin port of Sync Gateway they can do all kinds of nasty things. So the proper thing to do is to make the admin port something else (network internal IP, or localhost) and replicate against the public port.

Using the admin interface is probably why the connection failed. The admin interface is only bound to the loopback interface, i.e. it’s not reachable from another computer. Changing the URL in CBL to use port 4987 should fix it.

I can reach the sync gateway from the couchbase lite computer using the browser, the result of this request:
http://2.148.48.235:4987/
is this:
{“couchdb”:“Welcome”,“vendor”:{“name”:“Couchbase Sync Gateway”,“version”:“2.5”},“version”:“Couchbase Sync Gateway/2.5.0(271;bf3ddf6) EE”}

Still it is not working :frowning: any adivse?

Was that http access from the same machine as the one doing the replication and did you change the port to 4987 first? (Your code snippet uses 4985)

The access was done from the machine doing the replication, i.e. the machine that uses Couchbase.Lite.Enterprise 2.5.0.
I have changed the Uri to ws://2.148.48.235:4987/plappdb
I still get the same error. Both machines run in an internal dev network.
is there any advanced logging here that might provide more help?

Can we see the new failure message?

Same error as above.

2019-5-21 11:24:50.856+02:00 [1]| INFO)  [Database] (Startup) [1] CouchbaseLite/2.5.0 (.NET; Microsoft Windows 6.3.9600 ) Build/190 LiteCore/2.5.0 (1782) Commit/8bb2c29-0080df3
2019-5-21 11:24:50.861+02:00 [1]| WARNING)  [Database] (Database) [1] Database.SetLogLevel is deprecated, use Database.Log.Console instead.
2019-5-21 11:24:50.865+02:00 [1]| WARNING)  [Database] (Database) [1] Database.SetLogLevel is deprecated, use Database.Log.Console instead.
2019-5-21 11:24:50.881+02:00 [1]| WARNING)  [Database] (Logging) [1] Database.Log.File.Config is null, meaning file logging is disabled.  Log files required for product support are not being generated
.
2019-5-21 11:24:51.182+02:00 [9]| WARNING)  [Replicator] (WindowsProxy) [9] Call to WinHttpGetProxyForUrl failed (possible direct connection)...
2019-5-21 11:25:06.245+02:00 [7]| WARNING)  [Database] (Status) [7] No mapping for OperationCanceledException; interpreting as 'UnexpectedError'
2019-5-21 11:25:06.259+02:00 [14]| WARNING)  [Network] {C4SocketImpl#1}==> class litecore::repl::C4SocketImpl ws://2.148.48.235:4987/plappdb/_blipsync @00000027FEA17D30
2019-5-21 11:25:06.262+02:00 [14]| WARNING)  [Network] {C4SocketImpl#1} Unexpected or unclean socket disconnect! (reason=Unknown error, code=10)
2019-5-21 11:25:06.276+02:00 [15]| ERROR)  [Replicator] {Repl#2}==> class litecore::repl::Replicator D:\Innovationsprojekte\CouchbaseMobile\CouchbaseLiteConsole\bin\Debug\netcoreapp2.2\CouchbaseLite\p
lappdb.cblite2\ ->ws://2.148.48.235:4987/plappdb/_blipsync @00000027FF6A8D98
2019-5-21 11:25:06.278+02:00 [15]| ERROR)  [Replicator] {Repl#2} Got LiteCore error: LiteCore error 26 "The operation was canceled."

The communications between your client and your SG are being interrupted:

 [Network] {C4SocketImpl#1} Unexpected or unclean socket disconnect! (reason=Unknown error, code=10)

This is likely to be something to do with your network. We have seen a lot of people having this kind of trouble when using app-layer routers

I enabled verbose logging, I hope it helps. Still get the same error:

2019-5-23 10:15:56.863+02:00 [1]| INFO)  [Database] (Startup) [1] CouchbaseLite/2.5.0 (.NET; Microsoft Windows 6.3.9600 ) Build/190 LiteCore/2.5.0 (1782) Commit/8bb2c29-0080df3
2019-5-23 10:15:56.871+02:00 [1]| WARNING)  [Database] (Database) [1] Database.SetLogLevel is deprecated, use Database.Log.Console instead.
2019-5-23 10:15:56.874+02:00 [1]| WARNING)  [Database] (Database) [1] Database.SetLogLevel is deprecated, use Database.Log.Console instead.
2019-5-23 10:15:56.892+02:00 [1]| WARNING)  [Database] (Logging) [1] Database.Log.File.Config is null, meaning file logging is disabled.  Log files required for product support are not being generated
.
2019-5-23 10:15:57.003+02:00 [1]| VERBOSE)  [Database] {DB#1}==> class litecore::SQLiteDataFile D:\Innovationsprojekte\CouchbaseMobile\CouchbaseLiteConsole\bin\Debug\netcoreapp2.2\CouchbaseLite\plappd
b.cblite2\db.sqlite3 @000000832FDAD380
2019-5-23 10:15:57.007+02:00 [1]| VERBOSE)  [Database] {DB#1} begin transaction
2019-5-23 10:15:57.020+02:00 [1]| VERBOSE)  [Database] {DB#1} Saved '-Lpt4I4h2_kquHZ59trFMVw' rev #1-bc9f23a19f6aa0c547c5080f72e22d6b8a706006 as seq 31
2019-5-23 10:15:57.023+02:00 [1]| VERBOSE)  [Database] {DB#1} commit transaction
2019-5-23 10:15:57.028+02:00 [1]| INFO)  [Replicator] (Replicator) [1] Replicator[<*> ws://2.148.48.235:4987/plappdb]: Starting
2019-5-23 10:15:57.047+02:00 [1]| INFO)  [Database] {DB#2}==> class litecore::SQLiteDataFile D:\Innovationsprojekte\CouchbaseMobile\CouchbaseLiteConsole\bin\Debug\netcoreapp2.2\CouchbaseLite\plappdb.c
blite2\db.sqlite3 @000000832FE23F40
2019-5-23 10:15:57.049+02:00 [1]| INFO)  [Database] {DB#2} Opening database
2019-5-23 10:15:57.051+02:00 [1]| INFO)  [Network] {Connection#3}==> class litecore::blip::Connection ->ws://2.148.48.235:4987/plappdb/_blipsync @000000832FD9B1B0
2019-5-23 10:15:57.053+02:00 [1]| INFO)  [Network] {Connection#3} Opening connection...
2019-5-23 10:15:57.054+02:00 [1]| INFO)  [Replicator] Starting Scheduler<0000008315D03220> with 4 threads
2019-5-23 10:15:57.057+02:00 [1]| INFO)  [Replicator] {Repl#4}==> class litecore::repl::Replicator D:\Innovationsprojekte\CouchbaseMobile\CouchbaseLiteConsole\bin\Debug\netcoreapp2.2\CouchbaseLite\pla
ppdb.cblite2\ ->ws://2.148.48.235:4987/plappdb/_blipsync @0000008330E75748
2019-5-23 10:15:57.058+02:00 [1]| INFO)  [Replicator] {Repl#4} Push=continuous, Pull=continuous, Options={{auth:{password:"********", type:"Basic", username:"sync_gateway"}, headers:{User-Agent:"Couch
baseLite/2.5.0 (.NET; Microsoft Windows 6.3.9600 ) Build/190 LiteCore/2.5.0 (1782) Commit/8bb2c29-0080df3"}}}
2019-5-23 10:15:57.067+02:00 [1]| INFO)  [Replicator] (Replicator) [1] Replicator[<*> ws://2.148.48.235:4987/plappdb] is Connecting, progress 0/0
2019-5-23 10:15:57.070+02:00 [1]| INFO)  [Replicator] (Replicator) [1] Replicator[<*> ws://2.148.48.235:4987/plappdb] is Connecting, progress 0/0
2019-5-23 10:16:21.069+02:00 [5]| VERBOSE)  [Database] {DB#1} begin transaction
2019-5-23 10:16:21.080+02:00 [5]| VERBOSE)  [Database] {DB#1} abort transaction
2019-5-23 10:16:21.129+02:00 [5]| INFO)  [Database] (Database) [5] DB[D:\Innovationsprojekte\CouchbaseMobile\CouchbaseLiteConsole\bin\Debug\netcoreapp2.2\CouchbaseLite\plappdb.cblite2\] purged 0 expir
ed documents
2019-5-23 10:16:21.133+02:00 [5]| VERBOSE)  [Database] {DB#1} Next expiration time is 0
2019-5-23 10:16:21.135+02:00 [5]| INFO)  [Database] (Database) [5] No pending doc expirations
2019-5-23 10:16:21.156+02:00 [6]| INFO)  [Replicator] {Repl#4} activityLevel=connecting: connectionState=1
2019-5-23 10:16:21.176+02:00 [12]| VERBOSE)  [Replicator] {DBWorker#5}==> class litecore::repl::DBWorker ->ws://2.148.48.235:4987/plappdb/_blipsync @0000008330ED9378
2019-5-23 10:16:21.180+02:00 [12]| VERBOSE)  [Replicator] {DBWorker#5} Checkpoint doc ID = cp-VHImgHrjCZB72BZkKhAAMI5mhOU=
2019-5-23 10:16:21.183+02:00 [12]| VERBOSE)  [Replicator] {DBWorker#5} Remote-DB ID 5 found for target <ws://2.148.48.235:4987/plappdb/_blipsync>
2019-5-23 10:16:21.185+02:00 [12]| INFO)  [Replicator] {DBWorker#5} activityLevel=idle: pendingResponseCount=0, eventCount=1, activeDocs=0
2019-5-23 10:16:21.187+02:00 [12]| VERBOSE)  [Replicator] {DBWorker#5} now idle
2019-5-23 10:16:21.195+02:00 [13]| INFO)  [Replicator] {Repl#4} No local checkpoint 'cp-VHImgHrjCZB72BZkKhAAMI5mhOU='
2019-5-23 10:16:21.197+02:00 [13]| INFO)  [Replicator] {Repl#4} activityLevel=connecting: connectionState=1
2019-5-23 10:16:21.199+02:00 [13]| INFO)  [Replicator] {Repl#4} pushStatus=busy, pullStatus=busy, dbStatus=idle, progress=0/0
2019-5-23 10:16:21.201+02:00 [13]| INFO)  [Replicator] {Repl#4} activityLevel=connecting: connectionState=1
2019-5-23 10:16:21.222+02:00 [11]| WARNING)  [Replicator] (WindowsProxy) [11] Call to WinHttpGetProxyForUrl failed (possible direct connection)...
2019-5-23 10:16:36.242+02:00 [9]| INFO)  [Replicator] (WebSocketWrapper) [9] WebSocket CLOSED WITH ERROR: System.OperationCanceledException: The operation was canceled.
2019-5-23 10:16:36.295+02:00 [9]| WARNING)  [Database] (Status) [9] No mapping for OperationCanceledException; interpreting as 'UnexpectedError'
2019-5-23 10:16:36.310+02:00 [17]| WARNING)  [Network] {C4SocketImpl#6}==> class litecore::repl::C4SocketImpl ws://2.148.48.235:4987/plappdb/_blipsync @0000008315D779D0
2019-5-23 10:16:36.313+02:00 [17]| WARNING)  [Network] {C4SocketImpl#6} Unexpected or unclean socket disconnect! (reason=Unknown error, code=10)
2019-5-23 10:16:36.316+02:00 [17]| INFO)  [Network] {C4SocketImpl#6} sent 0 bytes, rcvd 0, in 0.000 sec (-nan(ind)/sec, -nan(ind)/sec)
2019-5-23 10:16:36.329+02:00 [6]| INFO)  [Network] {Connection#3} Closed with Unknown error 10: The operation was canceled.
2019-5-23 10:16:36.332+02:00 [12]| INFO)  [Replicator] {Repl#4} Connection closed with Unknown error 10: "The operation was canceled." (state=1)
2019-5-23 10:16:36.342+02:00 [18]| INFO)  [Replicator] {DBWorker#5} activityLevel=idle: pendingResponseCount=0, eventCount=1, activeDocs=0
2019-5-23 10:16:36.344+02:00 [12]| ERROR)  [Replicator] {Repl#4} Got LiteCore error: LiteCore error 26 "The operation was canceled."
2019-5-23 10:16:36.347+02:00 [12]| VERBOSE)  [Replicator] {Repl#4} progress +0/+0, 0 docs -- now 0 / 0, 0 docs
2019-5-23 10:16:36.349+02:00 [12]| INFO)  [Replicator] {Repl#4} activityLevel=stopped: connectionState=-1
2019-5-23 10:16:36.351+02:00 [12]| INFO)  [Replicator] {Repl#4} now stopped
2019-5-23 10:16:36.354+02:00 [18]| INFO)  [Replicator] {Push#7}==> class litecore::repl::Pusher ->ws://2.148.48.235:4987/plappdb/_blipsync @0000008330EDE648
2019-5-23 10:16:36.356+02:00 [18]| INFO)  [Replicator] {Push#7} activityLevel=stopped: pendingResponseCount=0, caughtUp=0, changeLists=0, revsInFlight=0, blobsInFlight=0, awaitingReply=0, revsToSend=0
, pendingSequences=0
2019-5-23 10:16:36.359+02:00 [18]| VERBOSE)  [Replicator] {Push#7} now stopped
2019-5-23 10:16:36.361+02:00 [18]| INFO)  [Replicator] BLIP sent 0 msgs (0 bytes), rcvd 0 msgs (0 bytes) in 39.305 sec. Max outbox depth was 0, avg -nan(ind)
2019-5-23 10:16:36.364+02:00 [18]| INFO)  [Replicator] {Pull#8}==> class litecore::repl::Puller ->ws://2.148.48.235:4987/plappdb/_blipsync @0000008330EDE8D8
2019-5-23 10:16:36.366+02:00 [18]| INFO)  [Replicator] {Pull#8} activityLevel=stopped: pendingResponseCount=0, _caughtUp=0, _waitingForChangesCallback=0, _pendingRevMessages=0, _activeIncomingRevs=0
2019-5-23 10:16:36.369+02:00 [18]| VERBOSE)  [Replicator] {Pull#8} now stopped
2019-5-23 10:16:36.370+02:00 [12]| INFO)  [Replicator] (Replicator) [12] Permanent error encountered (LiteCoreDomain / 26), giving up...
2019-5-23 10:16:36.373+02:00 [18]| VERBOSE)  [Database] {DB#2} Pre-close housekeeping: 0 of 10 pages free (0%)
2019-5-23 10:16:36.376+02:00 [18]| VERBOSE)  [Database] {DB#2} Closed SQLite database
2019-5-23 10:16:36.380+02:00 [18]| INFO)  [Database] {DB#2} Closing database
2019-5-23 10:16:36.388+02:00 [12]| INFO)  [Replicator] (Replicator) [12] Replicator[<*> ws://2.148.48.235:4987/plappdb] is Stopped, progress 0/0

Yes. Again, the error is here:

Unexpected or unclean socket disconnect! (reason=Unknown error, code=10)

For some reason, the connection between the client and the SG is being interrupted. This is very unlikely to be an issue with either CBL or the SG. It is most likely to be something in your network. Perhaps something like this:

Can you get at logs for the SG? That might provide more insight.

Base on the log, the cbl never successfully connect to the sg. I recommend you to follow our sample app Developer Portal | Couchbase to make sure your setup is correct.
Also @borrrden asked you did you change the port to 4987 first? (Your old code snippet uses 4985) Can you answer on that as well?

thank you balke and sandy. You were right there was an issue with one machine in the network. I change the SG machine and now I can successfully replicate from client to SG to server.

I have one, I hope small issue, left.

At the moment I can replicate successfully if I use the SG adminInterface. if I use the normal interface I get an authentication 401 error, here is the client log:

2019-5-24 04:54:41.976+02:00 [1]| INFO)  [Database] (Startup) [1] CouchbaseLite/2.5.0 (.NET; Microsoft Windows 6.3.9600 ) Build/190 LiteCore/2.5.0 (1782) Commit/8bb2c29-0080df3
2019-5-24 04:54:41.982+02:00 [1]| WARNING)  [Database] (Database) [1] Database.SetLogLevel is deprecated, use Database.Log.Console instead.
2019-5-24 04:54:41.984+02:00 [1]| WARNING)  [Database] (Database) [1] Database.SetLogLevel is deprecated, use Database.Log.Console instead.
2019-5-24 04:54:41.998+02:00 [1]| WARNING)  [Database] (Logging) [1] Database.Log.File.Config is null, meaning file logging is disabled.  Log files required for product support are not being generated
.
2019-5-24 04:54:42.122+02:00 [1]| VERBOSE)  [Database] {DB#1}==> class litecore::SQLiteDataFile D:\Innovationsprojekte\CouchbaseMobile\CouchbaseLiteConsole\bin\Debug\netcoreapp2.2\CouchbaseLite\plappd
b.cblite2\db.sqlite3 @000000BEF0F55170
2019-5-24 04:54:42.129+02:00 [1]| VERBOSE)  [Database] {DB#1} begin transaction
2019-5-24 04:54:42.147+02:00 [1]| VERBOSE)  [Database] {DB#1} Saved '-lXlkIimt50WsrMCVdtU9Ng' rev #1-7dbbff423b08fe739943a147a25ddc8a1f4db4b1 as seq 51
2019-5-24 04:54:42.154+02:00 [1]| VERBOSE)  [Database] {DB#1} commit transaction
2019-5-24 04:54:45.056+02:00 [5]| VERBOSE)  [Database] {DB#1} begin transaction
2019-5-24 04:54:45.059+02:00 [5]| VERBOSE)  [Database] {DB#1} abort transaction
2019-5-24 04:54:45.065+02:00 [5]| INFO)  [Database] (Database) [5] DB[D:\Innovationsprojekte\CouchbaseMobile\CouchbaseLiteConsole\bin\Debug\netcoreapp2.2\CouchbaseLite\plappdb.cblite2\] purged 0 expir
ed documents
2019-5-24 04:54:45.068+02:00 [5]| VERBOSE)  [Database] {DB#1} Next expiration time is 0
2019-5-24 04:54:45.071+02:00 [5]| INFO)  [Database] (Database) [5] No pending doc expirations
r
2019-5-24 04:54:49.141+02:00 [1]| INFO)  [Replicator] (Replicator) [1] Replicator[<*> ws://2.148.48.229:4987/plappdb]: Starting
2019-5-24 04:54:49.162+02:00 [1]| INFO)  [Database] {DB#2}==> class litecore::SQLiteDataFile D:\Innovationsprojekte\CouchbaseMobile\CouchbaseLiteConsole\bin\Debug\netcoreapp2.2\CouchbaseLite\plappdb.c
blite2\db.sqlite3 @000000BEF0FB0750
2019-5-24 04:54:49.164+02:00 [1]| INFO)  [Database] {DB#2} Opening database
2019-5-24 04:54:49.166+02:00 [1]| INFO)  [Network] {Connection#3}==> class litecore::blip::Connection ->ws://2.148.48.229:4987/plappdb/_blipsync @000000BEF0F24310
2019-5-24 04:54:49.167+02:00 [1]| INFO)  [Network] {Connection#3} Opening connection...
2019-5-24 04:54:49.169+02:00 [1]| INFO)  [Replicator] Starting Scheduler<000000BEEEE12520> with 4 threads
2019-5-24 04:54:49.171+02:00 [1]| INFO)  [Replicator] {Repl#4}==> class litecore::repl::Replicator D:\Innovationsprojekte\CouchbaseMobile\CouchbaseLiteConsole\bin\Debug\netcoreapp2.2\CouchbaseLite\pla
ppdb.cblite2\ ->ws://2.148.48.229:4987/plappdb/_blipsync @000000BEF201BCE8
2019-5-24 04:54:49.173+02:00 [1]| INFO)  [Replicator] {Repl#4} Push=continuous, Pull=continuous, Options={{auth:{password:"********", type:"Basic", username:"sync_gateway"}, headers:{User-Agent:"Couch
baseLite/2.5.0 (.NET; Microsoft Windows 6.3.9600 ) Build/190 LiteCore/2.5.0 (1782) Commit/8bb2c29-0080df3"}}}
2019-5-24 04:54:49.183+02:00 [1]| INFO)  [Replicator] (Replicator) [1] Replicator[<*> ws://2.148.48.229:4987/plappdb] is Connecting, progress 0/0
2019-5-24 04:54:49.187+02:00 [1]| INFO)  [Replicator] (Replicator) [1] Replicator[<*> ws://2.148.48.229:4987/plappdb] is Connecting, progress 0/0
client.Replicate() called
2019-5-24 04:54:49.287+02:00 [6]| INFO)  [Replicator] {Repl#4} activityLevel=connecting: connectionState=1
2019-5-24 04:54:49.301+02:00 [10]| VERBOSE)  [Replicator] {DBWorker#5}==> class litecore::repl::DBWorker ->ws://2.148.48.229:4987/plappdb/_blipsync @000000BEF2084828
2019-5-24 04:54:49.304+02:00 [10]| VERBOSE)  [Replicator] {DBWorker#5} Checkpoint doc ID = cp-6VogQosg0pvaRPus+73CbXy8UyM=
2019-5-24 04:54:49.307+02:00 [10]| VERBOSE)  [Replicator] {DBWorker#5} Remote-DB ID 8 found for target <ws://2.148.48.229:4987/plappdb/_blipsync>
2019-5-24 04:54:49.309+02:00 [10]| INFO)  [Replicator] {DBWorker#5} activityLevel=idle: pendingResponseCount=0, eventCount=1, activeDocs=0
2019-5-24 04:54:49.311+02:00 [10]| VERBOSE)  [Replicator] {DBWorker#5} now idle
2019-5-24 04:54:49.318+02:00 [11]| INFO)  [Replicator] {Repl#4} No local checkpoint 'cp-6VogQosg0pvaRPus+73CbXy8UyM='
2019-5-24 04:54:49.320+02:00 [11]| INFO)  [Replicator] {Repl#4} activityLevel=connecting: connectionState=1
2019-5-24 04:54:49.321+02:00 [11]| INFO)  [Replicator] {Repl#4} pushStatus=busy, pullStatus=busy, dbStatus=idle, progress=0/0
2019-5-24 04:54:49.323+02:00 [11]| INFO)  [Replicator] {Repl#4} activityLevel=connecting: connectionState=1
2019-5-24 04:54:49.341+02:00 [9]| WARNING)  [Replicator] (WindowsProxy) [9] Call to WinHttpGetProxyForUrl failed (possible direct connection)...
2019-5-24 04:54:49.392+02:00 [14]| INFO)  [Replicator] (WebSocketWrapper) [14] WebSocket connecting to 2.148.48.229:4987
2019-5-24 04:54:49.413+02:00 [17]| VERBOSE)  [Replicator] (WebSocketWrapper) [17] WebSocket sent HTTP request...
2019-5-24 04:54:49.417+02:00 [17]| INFO)  [Replicator] (HTTPLogic) [17] HTTP auth failed
2019-5-24 04:54:49.429+02:00 [17]| INFO)  [Replicator] (WebSocketWrapper) [17] WebSocket CLOSED WITH ERROR: Couchbase.Lite.CouchbaseNetworkException: CouchbaseLiteException (WebSocketDomain / 401): (u
nknown HTTP status).
2019-5-24 04:54:49.434+02:00 [6]| INFO)  [Replicator] {Repl#4} activityLevel=connecting: connectionState=1
2019-5-24 04:54:49.461+02:00 [19]| WARNING)  [Network] {C4SocketImpl#6}==> class litecore::repl::C4SocketImpl ws://2.148.48.229:4987/plappdb/_blipsync @000000BEEEE87160
2019-5-24 04:54:49.463+02:00 [19]| WARNING)  [Network] {C4SocketImpl#6} Unexpected or unclean socket disconnect! (reason=WebSocket status, code=401)
2019-5-24 04:54:49.468+02:00 [19]| INFO)  [Network] {C4SocketImpl#6} sent 0 bytes, rcvd 0, in 0.000 sec (-nan(ind)/sec, -nan(ind)/sec)
2019-5-24 04:54:49.476+02:00 [10]| INFO)  [Network] {Connection#3} Closed with WebSocket status 401: CouchbaseLiteException (WebSocketDomain / 401): (unknown HTTP status).
2019-5-24 04:54:49.483+02:00 [20]| INFO)  [Replicator] {Repl#4} Connection closed with WebSocket status 401: "CouchbaseLiteException (WebSocketDomain / 401): (unknown HTTP status)." (state=1)
2019-5-24 04:54:49.485+02:00 [11]| INFO)  [Replicator] {DBWorker#5} activityLevel=idle: pendingResponseCount=0, eventCount=1, activeDocs=0
2019-5-24 04:54:49.487+02:00 [20]| ERROR)  [Replicator] {Repl#4} Got LiteCore error: WebSocket error 401 "CouchbaseLiteException (WebSocketDomain / 401): (unknown HTTP status)."
2019-5-24 04:54:49.489+02:00 [20]| VERBOSE)  [Replicator] {Repl#4} progress +0/+0, 0 docs -- now 0 / 0, 0 docs
2019-5-24 04:54:49.491+02:00 [20]| INFO)  [Replicator] {Repl#4} activityLevel=stopped: connectionState=-1
2019-5-24 04:54:49.493+02:00 [20]| INFO)  [Replicator] {Repl#4} now stopped
2019-5-24 04:54:49.494+02:00 [11]| INFO)  [Replicator] {Push#7}==> class litecore::repl::Pusher ->ws://2.148.48.229:4987/plappdb/_blipsync @000000BEF20892E8
2019-5-24 04:54:49.496+02:00 [11]| INFO)  [Replicator] {Push#7} activityLevel=stopped: pendingResponseCount=0, caughtUp=0, changeLists=0, revsInFlight=0, blobsInFlight=0, awaitingReply=0, revsToSend=0
, pendingSequences=0
2019-5-24 04:54:49.498+02:00 [11]| VERBOSE)  [Replicator] {Push#7} now stopped
2019-5-24 04:54:49.500+02:00 [11]| INFO)  [Replicator] BLIP sent 0 msgs (0 bytes), rcvd 0 msgs (0 bytes) in 0.329 sec. Max outbox depth was 0, avg -nan(ind)
2019-5-24 04:54:49.502+02:00 [11]| INFO)  [Replicator] {Pull#8}==> class litecore::repl::Puller ->ws://2.148.48.229:4987/plappdb/_blipsync @000000BEF2089578
2019-5-24 04:54:49.504+02:00 [11]| INFO)  [Replicator] {Pull#8} activityLevel=stopped: pendingResponseCount=0, _caughtUp=0, _waitingForChangesCallback=0, _pendingRevMessages=0, _activeIncomingRevs=0
2019-5-24 04:54:49.505+02:00 [20]| INFO)  [Replicator] (Replicator) [20] Permanent error encountered (WebSocketDomain / 401), giving up...
2019-5-24 04:54:49.506+02:00 [11]| VERBOSE)  [Replicator] {Pull#8} now stopped
2019-5-24 04:54:49.509+02:00 [11]| VERBOSE)  [Database] {DB#2} Pre-close housekeeping: 0 of 11 pages free (0%)
2019-5-24 04:54:49.511+02:00 [11]| VERBOSE)  [Database] {DB#2} Closed SQLite database
2019-5-24 04:54:49.512+02:00 [11]| INFO)  [Database] {DB#2} Closing database
2019-5-24 04:54:49.515+02:00 [20]| INFO)  [Replicator] (Replicator) [20] Replicator[<*> ws://2.148.48.229:4987/plappdb] is Stopped, progress 0/0

Questions: Did you run the sync_gateway config after you update the config file so that 2.148.48.235:4987 takes affect? Did you access http://2.148.48.235:4987/plappdb from the browser and not seeing a broken link?

If answers for above questions are yes. NOW see your config here:

        "GUEST": { "disabled": false, "admin_channels": ["*"] }

I see you allow GUEST mode in sg config and you did not add any sg user. SO you have to remove _replicatorConfig.Authenticator = new BasicAuthenticator(“sync_gateway”, “start#123”); HTTP code 401 means Invalid login BTW

If you want to add sg user, do

        "GUEST": { "disabled": false, "admin_channels": ["*"] },
"FarisAhmed":{"password":"start#123"}
      },

then you can add _replicatorConfig.Authenticator = new BasicAuthenticator(“FarisAhmed”, “start#123”);

Faris could you detail what the problem was with one of your computers?
I am getting the same error message . I just started to work remotely connecting to the sync gateway and have not been able to get it running yet.

Not sure if its my provider or their setup.

Thanks,
Bryan

Hi Bryan,

I was working on three VMs inside a dev network, the connection failed cause the sync gateway machine was not configured correctly. My VM admin reconfigured that machine then everything worked.
I dropped this environment after I made it running and switched to using server and gateway as docker images localy, in this way I have all 3 participants on one machine

Regards,
Faris

Thanks Faris,
Our problem has been fixed, turned out to be more mundane - authorizations had been wiped out due to data refreshes and needed to be restored.