Client-Side timeout exceeded for operation

Occasionally, when I deploy my node application, this error occurs when trying to access the database:

 { CouchbaseError: Client-Side timeout exceeded for operation. Inspect network conditions or increase the timeout
  message: 'Client-Side timeout exceeded for operation. Inspect network conditions or increase the timeout',
  code: 23 }

Even though I have increased the bucket timeout value to 120 seconds, this error still occurs sometimes. (Bucket.operationTimeout = 120*1000;)

I added the statement process.exit(1); on Bucket.on('error') to force the restart of the service, but isn’t there any other way to try and reconnect with the database (if the case when the error message occurs is due to a timeout) ?

Hey @manusyone,

You can call bucket.shutdown() to close a bucket connection. It may be worth investigating the reason for your network latency rather than simply reconnecting. Would you be willing to provide a bit of information about the load profile of your application?

Cheers, Brett

Hello @brett19, thank you for your reply. I believe that the load profile is not relevant for this matter, since this only happens when I am starting my application (without any other applications using the database). Nonetheless, we are using a development environment only at this point, so the load is pretty reduced. If you still want the load profile, could you provide more information on which metrics would help?

The behavior is pretty strange; while this happens from time to time while starting the application, as soon as I restart the application everything goes smoothly. What I would like, at a lack of a better solution, is that on an error, the application tries to connect to the database again. Let me know if you need more information!

Thank you, Manuel

Hello @brett19! Do you have any news/suggestions to mitigate this issue? Do you need more information? We are rolling to production soon, and it is important for us to sort out this problem… Let me know if I can help in any way from our end. Thank you!

Hey @manusyone,

The clients will always continue trying to connect to the database assuming they successfully establish their first connection attempt (to receive a configuration). It sounds like it might be the case that your first connection is the one failing, since you say it only occurs at startup. Can you tell me a bit more about your environment and anything that might be affecting the SDK’s ability to connect to the server?

Cheers, Brett

Hi @brett19, thank you for getting back so quickly. We also have a Couchbase Server running on Google Cloud Platform that suffers from this issue as well.

Nonetheless, the server where the database is running has a single core and 8Gb of RAM. We have very few documents (less than 10K) and a single node. Couchbase version is 2.2.2, and Node version is 6.5.0. I can’t see any other aspect that might hinder the connection. Is there any log or set of configurations that I could provide in order to help?

Regards, Manuel

Hi @brett19! Not sure if this helps, but removing the port (8091) from the connection string appears to have solved the problem.

var Cluster = new couchbaseSDK.Cluster("couchbase://" + process.env.DB_HOST);

Does this make sense to you?

Regards, Manuel