Trying to connect remote Couchbase with credential but getting unambiguous_timeout (14)

When we are trying to connect remote Couchbase with credential , we getting

unambiguous_timeout and as result login failed to Couchbase.

We increased the timeout time upto 60 sec.

The below error details we are getting.

**Error: <ec=14, category=couchbase.common, message=unambiguous_timeout (14), C Source=C: \Jenkins\workspace\python\sdk\python-scripted-build-pipeline\py-client\src\connection.cxx:199>

Code snippet:

   try:
            print("Logging on to Couchbase")
            with open('config/cred.yaml', 'r') as stream:
                cred = yaml.safe_load(stream).get('cb')
                cb_username = cred.get('username')
                cb_password = cred.get('password')
            auth = PasswordAuthenticator(
                cb_username,
                cb_password,
            )
            print("Using password authenticator")
            options = ClusterOptions.create_options_with_profile(auth, KnownConfigProfiles.WanDevelopment)
            print("Got Credentials from couchbase, trying to login to couchbase")
            print("formatted URL :", 'couchbase://{}'.format(couchbase_url))
            cluster = Cluster('couchbase://{}'.format(couchbase_url), ClusterOptions(auth))
            print("cluster : ", cluster)
            cluster.wait_until_ready(timedelta(seconds=60),
                                     WaitUntilReadyOptions(service_types=[ServiceType.KeyValue, ServiceType.Query]))
            print("after login : ", couchbase_url)

We are using python sdk 3.11 and couchbase version Enterprise Edition 7.1.3

Can you describe how the client and server are connected? i.e. is this on your laptop connecting to a Docker container? Are you in a particular cloud provider?

Typically a timeout at this early stage is caused by some networking issue in between the client and server rather than a bug or performance issue.

You can also try using the sdk doctor to get more connection diagnostics:

And there is some good documentation in the Python SDK for error handling and troubleshooting:
Diagnosing and preventing Network Problems with Health Check | Couchbase Docs and Handling Errors | Couchbase Docs

(also note that version 4 of the Python SDK is available now, I don’t have any reason to suspect that upgrading would resolve the issue you’re having, but good to be aware of the latest version :slight_smile: )

1 Like

You can get additional logging by setting the environment variable before running
LCB_LOGLEVEL=5

Also - try using the latest version of the SDK.

Hi , When I am trying to connect couchbase server from my laptop using python sdk locally its working,
But when when i am trying to connect my same standalone application in remote desktop , then I am facing this issue(time out issue).

Hi , When I am trying to connect couchbase server from my laptop using python sdk locally its working,
But when when i am trying to connect my same standalone application in remote desktop , then I am facing this issue(time out issue). we are using latest sdk 4.
But we have java application which is running fine for both local and remote

Are you able to run a healthcheck from within that same application? Health Check | Couchbase Docs

The timeout exception should have RETRY_REASONS. Setting the LCB_LOGLEVEL=5 should also give more diagnostics

to set LCB_LOGLEVEL=5 just we have to set an env variable?
like below :slight_smile:

import base64
import re
from datetime import timedelta

import yaml
from couchbase.auth import PasswordAuthenticator
from couchbase.cluster import Cluster
from couchbase.options import (ClusterOptions, ClusterTimeoutOptions,
                               QueryOptions, KnownConfigProfiles)
import urllib3

import oc_handling as oc
from couchbase.diagnostics import ServiceType
from couchbase.options import WaitUntilReadyOptions

import couchbase

import logging

LCB_LOGLEVEL = 5

LOGGING_LOG_FORMAT = "%(asctime)s - %(levelname)s [ %(thread)d %(threadName)s ] : %(message)s"

LOGGING_LEVEL = logging.DEBUG

LOGGER = None

A shell environment variable.
Google : shell environment variable
Google : couchbase LCB_LOGLEVEL

Hi @abhijsar – Sorry, since you are using the 4.x SDK, the logging is different (we use our C++ SDK and not the C SDK as the 3.x version of the Python SDK did). See the 4.x logging documentation here. A quick way to get log information for the SDK is as follows (be sure to change test_script.py to the name of your python script). Also, you can use debug or trace logging levels as those will provide the most information for debugging purposes.

PYCBC_LOG_LEVEL=trace python test_script.py

Also as @perry has noted, using SDK Doctor is a good tool to use to make sure your connection is okay.

hi @jcasey @perry
getting this after using sdk doctor :
Summary:
e[33m[WARN]e[0m No certificate authority file specified (–tls-ca), skipping server certificate verification for this run.
e[33m[WARN]e[0m Your connection string specifies only a single host. You should consider adding additional static nodes from your cluster to this list to improve your applications fault-tolerance
e[31m[ERRO]e[0m Failed to fetch configuration via cccp from npcchbs69.abc.xyz.com:11207 (error: dial tcp 172.22.274.101:11207: i/o timeout)
e[31m[ERRO]e[0m Failed to fetch terse configuration via http from npcchbs69.abc.xyz.com:18091 (error: Get “http://npcchbs69.abc.xyz.com:18091/pools/default/b/”: net/http: HTTP/1.x transport connection broken: malformed HTTP response “\x15\x03\x03\x00\x02\x02”)
e[31m[ERRO]e[0m All endpoints specified by your connection string were unreachable, further cluster diagnostics are not possible.

what is wrong here?

@abhijsar

It looks to me like some pretty low-level networking issue is blocking communication. This is usually due to a firewall (or security group) configuration.

Can you share some more details on exactly how this is all setup? You mention a remote desktop…is that running on a cloud instance (and if so, which provider?). Is it Windows or Linux? Is Couchbase running in another cloud instance? Windows or Linux? Or is this all in your local datacenter/home network? Any docker, kubernetes or load balancers? And you mentioned that a java application is running fine…is that running in the exact same remote desktop and using the exact same connection string?

Sorry for all the questions, just trying to get a complete picture to identify some potential areas for digging into. If you have a license to our Enterprise Edition it might be worth opening a support ticket with the team, they’ll probably ask a lot of the same questions though :slight_smile:

Thank you so much, issue resolved ,it was firewall issue.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.