Shivansh Srivastava Shivansh Srivastava - 1 month ago 17
Scala Question

Couchbase Java SDK: concurrent timeout exception

I am using Couchbase 3.0 And I am facing this problem , that when I try to Open two buckets simultaneously It gives me the error

java.util.concurrent.TimeoutException
.

I have a case where I have to open two buckets simultaneously. When I comment one of the bucket opening line the code works just fine, but as soon as I want to open both the buckets It gives me an exception.

The Java SDK version is 2.1.3

java.lang.RuntimeException: java.util.concurrent.TimeoutException
at com.couchbase.client.java.util.Blocking.blockForSingle(Blocking.java:93) ~[java-client-2.1.3.jar:2.1.3]
at com.couchbase.client.java.CouchbaseCluster.openBucket(CouchbaseCluster.java:108) ~[java-client-2.1.3.jar:2.1.3]
at com.couchbase.client.java.CouchbaseCluster.openBucket(CouchbaseCluster.java:94) ~[java-client-2.1.3.jar:2.1.3]
at com.couchbase.client.java.CouchbaseCluster.openBucket(CouchbaseCluster.java:84) ~[java-client-2.1.3.jar:2.1.3]
at com.trakinvest.core.db.DB$CouchbaseService.bucket(DB.scala:155) ~[classes/:na]
at com.trakinvest.core.service.SearchServiceSpec$.<init>(SearchServiceSpec.scala:26) [test-classes/:na]
at com.trakinvest.core.service.SearchServiceSpec$.<clinit>(SearchServiceSpec.scala) [test-classes/:na]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [na:1.8.0_51]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [na:1.8.0_51]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [na:1.8.0_51]
at java.lang.reflect.Constructor.newInstance(Constructor.java:422) [na:1.8.0_51]
at org.specs2.reflect.Classes$class.createInstanceFor(Classes.scala:154) [specs2-common_2.11-2.3.12.jar:2.3.12]
at org.specs2.reflect.Classes$.createInstanceFor(Classes.scala:207) [specs2-common_2.11-2.3.12.jar:2.3.12]
at org.specs2.reflect.Classes$$anonfun$createInstanceOfEither$1.apply(Classes.scala:145) [specs2-common_2.11-2.3.12.jar:2.3.12]
at org.specs2.reflect.Classes$$anonfun$createInstanceOfEither$1.apply(Classes.scala:145) [specs2-common_2.11-2.3.12.jar:2.3.12]
at scala.Option.map(Option.scala:146) [scala-library-2.11.6.jar:na]
at org.specs2.reflect.Classes$class.createInstanceOfEither(Classes.scala:145) [specs2-common_2.11-2.3.12.jar:2.3.12]
at org.specs2.reflect.Classes$.createInstanceOfEither(Classes.scala:207) [specs2-common_2.11-2.3.12.jar:2.3.12]
at org.specs2.reflect.Classes$class.org$specs2$reflect$Classes$$createInstanceForConstructor(Classes.scala:118) [specs2-common_2.11-2.3.12.jar:2.3.12]
at org.specs2.reflect.Classes$$anonfun$4.apply(Classes.scala:98) [specs2-common_2.11-2.3.12.jar:2.3.12]
at org.specs2.reflect.Classes$$anonfun$4.apply(Classes.scala:98) [specs2-common_2.11-2.3.12.jar:2.3.12]
at scala.collection.immutable.List.map(List.scala:273) [scala-library-2.11.6.jar:na]
at org.specs2.reflect.Classes$class.tryToCreateObjectEither(Classes.scala:98) [specs2-common_2.11-2.3.12.jar:2.3.12]
at org.specs2.reflect.Classes$.tryToCreateObjectEither(Classes.scala:207) [specs2-common_2.11-2.3.12.jar:2.3.12]
at org.specs2.reflect.Classes$class.tryToCreateObject(Classes.scala:70) [specs2-common_2.11-2.3.12.jar:2.3.12]
at org.specs2.reflect.Classes$.tryToCreateObject(Classes.scala:207) [specs2-common_2.11-2.3.12.jar:2.3.12]
at org.specs2.specification.SpecificationStructure$$anonfun$createSpecificationFromClassOrObject$1.apply(BaseSpecification.scala:132) [specs2-core_2.11-2.3.12.jar:2.3.12]
at org.specs2.specification.SpecificationStructure$$anonfun$createSpecificationFromClassOrObject$1.apply(BaseSpecification.scala:132) [specs2-core_2.11-2.3.12.jar:2.3.12]
at scala.Option.orElse(Option.scala:289) [scala-library-2.11.6.jar:na]
at org.specs2.specification.SpecificationStructure$.createSpecificationFromClassOrObject(BaseSpecification.scala:132) [specs2-core_2.11-2.3.12.jar:2.3.12]
at org.specs2.specification.SpecificationStructure$.createSpecificationEither(BaseSpecification.scala:117) [specs2-core_2.11-2.3.12.jar:2.3.12]
at org.specs2.runner.SbtRunner.org$specs2$runner$SbtRunner$$specificationRun(SbtRunner.scala:73) [specs2-core_2.11-2.3.12.jar:2.3.12]
at org.specs2.runner.SbtRunner$$anonfun$newTask$1$$anon$5.execute(SbtRunner.scala:59) [specs2-core_2.11-2.3.12.jar:2.3.12]
at sbt.ForkMain$Run$2.call(ForkMain.java:294) [test-agent-0.13.8.jar:0.13.8]
at sbt.ForkMain$Run$2.call(ForkMain.java:284) [test-agent-0.13.8.jar:0.13.8]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_51]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_51]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_51]
Caused by: java.util.concurrent.TimeoutException: null

Answer

I've upgraded the version of Couchbase SDK and the problem does not occur now ! I think it might be a versioning problem ! If anyone else finds this issue try to upgrade the Couchbase SDK to resolve this error !

P.S. It was quite a long chat and hence i am giving this answer here !

Comments