When processing a document that has been seen over DCP we check whether a document has a sync data xattr, even when running in non-xattr mode. This allows an upgrade to shared bucket access with no down-time.
However, this check is even performed when the target server doesn't support SUBDOC operations. This is an issue when using Couchbase Server 4.x as this doesn't support SUBDOC operations. Therefore when this is attempted an error occurs and the connection that the operation was performed on closes.
If there are any other operations waiting on that connection they get a 500 error and this is seen in Sync Gateway as a network error.
With this in mind we should check the server version before attempting to perform a SUBDOC operation: https://github.com/couchbase/sync_gateway/blob/master/db/crud.go#L1664