Connection to Database throws LCB_ERR_PROTOCOL_ERROR (1050)

Hi ,

I’m using Python SDK (3.0.4b1) to execute query , but I’m encountering the below ERROR (frequently) while making a connection to the database.

<RC=0x41A[LCB_ERR_PROTOCOL_ERROR (1050)], There was a problem while trying to send/receive your request over the network. This may be a result of a bad network or a misconfigured client or server, C Source=(src/bucket.c,1209)>.

Below is the code snippet

try:
    self.cluster = Cluster(dataBaseURL, ClusterOptions(PasswordAuthenticator(username=userName, password=password), timeout_options=timeout_options))
    self.bucket = self.cluster.bucket(bucketName)
except Exception as e:
            print("Connection to Database failed!!")
            print(e)

Can anyone help me in resolving this ?

Thanks

Hi Ashish -

That error can be hit when attempting to use a newly created bucket, where the bucket creation has not been completely propagated. https://issues.couchbase.com/browse/PYCBC-1134. The solution to that is to wait a brief period (one second?) and retry. From the issue:

File "/usr/local/lib/python3.9/site-packages/couchbase/cluster.py", line 495, in bucket
return self._cluster.open_bucket(name, admin=self._admin)
File "/usr/local/lib/python3.9/site-packages/couchbase_core/cluster.py", line 128, in open_bucket
rv = self.bucket_factory(str(connstr), **kwargs)
File "/usr/local/lib/python3.9/site-packages/couchbase/bucket.py", line 198, in _*init*_
super(Bucket,self)._*init*_(connection_string, **self._bucket_args)
File "/usr/local/lib/python3.9/site-packages/couchbase_core/client.py", line 159, in _*init*_
self._do_ctor_connect()
File "/usr/local/lib/python3.9/site-packages/couchbase_core/client.py", line 168, in _do_ctor_connect
self._connect()
couchbase.exceptions.ProtocolException: <RC=0x41A[LCB_ERR_PROTOCOL_ERROR (1050)], There was a problem while trying to send/receive your request over the network. This may be a result of a bad network or a misconfigured client or server, C Source=(src/bucket.c,1209)>
  • Mike

Hi @Ashish_M_J - In addition to Michael’s suggestion, I would strongly advise to move to a more recent version of the SDK (ideally a 4.x version if you can). But, at the very least please try and move to a GA version (you mentioned you are using a beta version 3.0.4b1).

1 Like