Details
-
Bug
-
Resolution: Fixed
-
Major
-
None
-
3.1.3
-
1
Description
Hi Michael,
CB Server: Enterprise Edition 7.0.0 build 4797
Java SDK: 3.1.3
Reproducable Steps:
- Assume a bucket exists with name "sampleBucket"
- Now drop this bucket and immediately create the bucket with same name
- Wait until the bucket is ready
- Create a custom collection and try upserting a document.
- The SDK times out with UnambiguousTimeoutException
// code placeholder
|
//Creates a new bucket. Deletes old buckets with same name before creating the bucket
|
public static Bucket createBucket(Cluster cluster, String bucketName, BucketSettings bsettings ){ |
bsettings = BucketSettings.create(bucketName)
|
.bucketType(BucketType.COUCHBASE)
|
.flushEnabled(true) |
.ramQuotaMB(100); |
|
try{ |
cluster.buckets().dropBucket(bucketName);
|
cluster.buckets().createBucket(bsettings);
|
logger.warn("Bucket {} is created successfully ", bucketName); |
}catch (BucketExistsException e){ |
//Should not be reaching here since we are explicitly deleting any old bucket with same name |
logger.warn("Bucket {} already exists. So not creating it", bucketName); |
}
|
Bucket bucket = cluster.bucket(bucketName);
|
bucket.waitUntilReady(Duration.ofSeconds(30)); |
return bucket; |
}
|
|
//Create a new bucket and collection but returns the access to bucket only
|
public static Bucket prepareBucketAndCollection(SharedTestState shared, CollectionSpec collectionSpec, String bucketName){ |
Bucket newTestBucket = createBucket(shared.cluster(), bucketName);
|
|
try { |
newTestBucket.collections().createCollection(collectionSpec);
|
}
|
catch (CouchbaseException err) { |
logger.warn("Collection already exists so not creating it"); |
}
|
waitUntilCondition(() -> collectionExists(newTestBucket, collectionSpec));
|
return newTestBucket; |
} public static boolean collectionExists(Bucket bucket, CollectionSpec spec) { |
try { |
ScopeSpec scope = bucket.collections().getScope(spec.scopeName());
|
if(scope.collections().contains(spec)){ |
//waits until the collection is operable before returning true |
waitUntilCondition(() -> collectionOperable(bucket.scope(spec.scopeName()).collection(spec.name()))) ;
|
return true; |
}else |
{
|
return false; |
}
|
} catch (ScopeNotFoundException e) { |
return false; |
}
|
}
|
|
//Some dummy operations on the collection. Checks collection is ready for both read and write operations |
public static boolean collectionOperable(Collection collection){ |
String docId = TestUtils.docId();
|
boolean upsertCompleted=false; |
int upsertTryCount =10; while(!upsertCompleted && upsertTryCount>0){ |
try{ |
logger.info("Upserting document to ensure collection is Operable"); |
collection.upsert(docId,initial);
|
upsertCompleted=true; |
}catch(AmbiguousTimeoutException e){ |
upsertTryCount--;
|
logger.info("Collection upsert failed. Trying again"); |
}
|
}
|
GetResult get = collection.get(docId);
|
JsonObject fetchedContent = get.contentAsObject();
|
return fetchedContent.equals(initial); |
}
|
Sample logs:
com.couchbase.client.core.error.UnambiguousTimeoutException: GetRequest, Reason: TIMEOUTcom.couchbase.client.core.error.UnambiguousTimeoutException: GetRequest, Reason: TIMEOUT {"cancelled":true,"completed":true,"coreId":"0x4376ffb00000002","idempotent":true,"reason":"TIMEOUT","requestId":282,"requestType":"GetRequest","retried":14,"retryReasons":["NODE_NOT_AVAILABLE"],"service":{"bucket":"secondTestBucket","collection":"metadata","documentId":"a08678c5-90cb-40e8-ac54-065d260a4cd3","opaque":"0x17c","scope":"_default","type":"kv"},"timeoutMs":2500,"timings":{"totalMicros":2507738}} at com.couchbase.client.java.AsyncUtils.block(AsyncUtils.java:51) at com.couchbase.client.java.Collection.get(Collection.java:184) at com.couchbase.transactions.util.TransactionCollectionUtility.collectionOperable(TransactionCollectionUtility.java:425) at com.couchbase.transactions.util.TransactionCollectionUtility.lambda$collectionExists$9(TransactionCollectionUtility.java:398) at org.awaitility.core.CallableCondition$ConditionEvaluationWrapper.eval(CallableCondition.java:99) at org.awaitility.core.ConditionAwaiter$ConditionPoller.call(ConditionAwaiter.java:222) at org.awaitility.core.ConditionAwaiter$ConditionPoller.call(ConditionAwaiter.java:209) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Suppressed: java.lang.Exception: The above exception was originally thrown by another thread at the following location. at com.couchbase.client.core.msg.BaseRequest.cancel(BaseRequest.java:170) at com.couchbase.client.core.Timer.lambda$register$2(Timer.java:157) at com.couchbase.client.core.deps.io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:672) at com.couchbase.client.core.deps.io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:747) at com.couchbase.client.core.deps.io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:472) at com.couchbase.client.core.deps.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ... 1 more
|