2

I am doing a lookup operation Couchbase Java SDK 3.0.9 which looks like this:

// Set up
bucket = cluster.bucket("my_bucket")
collection = bucket.defaultCollection()
// Look up operation
val specs = listOf(LookupInSpecStandard.get("hash"))
collection.lookupIn(id, specs)

The error I get is BUCKET_NOT_AVAILABLE. Here are is the full message:

com.couchbase.client.core.error.UnambiguousTimeoutException: SubdocGetRequest, Reason: TIMEOUT {"cancelled":true,"completed":true,"coreId":"0xdb7f8e4800000003","idempotent":true,"reason":"TIMEOUT","requestId":608806,"requestType":"SubdocGetRequest","retried":39,"retryReasons":["BUCKET_NOT_AVAILABLE"],"service":{"bucket":"export","collection":"_default","documentId":"export:main","opaque":"0xcfefb","scope":"_default","type":"kv"},"timeoutMs":15000,"timings":{"totalMicros":15008977}}

The strange part is that this code hasn't been touched for months and the lookup broke out of a sudden. The CB cluster is working fine. Its version is Enterprise Edition 6.5.1 build 6299.

Do you have any ideas what might have gone wrong?

Teodor Dimitrov
  • 1,003
  • 2
  • 12
  • 19
  • the name of the bucket isn't actually "My Bucket", is it? Spaces aren't allowed in bucket names. Also, the error says "unable to upsert", but I don't see an upsert operation in the code sample you provided. Did you leave that part out? – Matthew Groves Jan 06 '21 at 15:51
  • No the logging is wrong because we are doing lookup before the actual upsert. I will edit that. I've managed to fix this by recreating the indices used in my bucket. However, I am still investigating when this is happening. Maybe when I send too many db requests in one second it times out. – Teodor Dimitrov Jan 07 '21 at 12:16
  • @TeodorDimitrov Have you already been able to solve the issue? I have exactly the same problem with the .NET client. Code has not changed for weeks. – Andre Hofmeister Feb 09 '21 at 14:27

2 Answers2

1

This problem can occur because of firewall. You need to allow these ports.

Client-to-node

Unencrypted: 8091-8097, 9140 [3], 11210

Encrypted: 11207, 18091-18095, 18096, 18097

You can check more from below

https://docs.couchbase.com/server/current/install/install-ports.html#_footnotedef_2

Sahin Yanlık
  • 1,171
  • 2
  • 11
  • 21
0

Note that in Couchbase Java SDK 3.x, the Cluster::bucket method returns instantly, and continues opening a bucket in the background. So the first operation you perform - a lookupIn here - needs to wait for that resource opening to complete before it can proceed. It looks like it took a little longer to access the Couchbase bucket than usual and you got a timeout.

I recommend using the Bucket::waitUntilReady method after opening a bucket, to block until the resource opening is complete:

bucket = cluster.bucket("my_bucket")
bucket.waitUntilReady(Duration.ofMinutes(1));
Graham Pople
  • 416
  • 4
  • 8
  • 1
    The bucket was open, because many operations succeeded before that one. My guess is that due to higher traffic it broke with this message. The error is not showing anymore after we scaled the CB server. – Teodor Dimitrov Feb 10 '21 at 12:43
  • couchbase is far from being production ready. – USS-Montana Nov 09 '21 at 19:32