TimeoutException on n1ql query and fatal error: runtime: out of memory in cbq-engine


#1

Client code

CouchbaseEnvironment env = DefaultCouchbaseEnvironment
.builder()
.queryEnabled(true)
.build();
cluster = CouchbaseCluster.create(env, host);
this.cbBucket = cluster.openBucket(bucket);

QueryResult queryResult = cbBucket.query(“select * from default order by submittedOn limit 1”);

Getting this error

12:07:45.760 [cb-io-1-2] DEBUG c.c.client.core.endpoint.Endpoint - [pt-host/10.1.21.38:8091][ConfigEndpoint]: Connected Endpoint.
12:07:45.760 [cb-io-1-2] DEBUG c.c.client.core.service.Service - [pt-host][ConfigService]: Connected Service.
12:07:45.760 [cb-io-1-3] DEBUG c.c.client.core.endpoint.Endpoint - [pt-host/10.1.21.38:8092][ViewEndpoint]: Connected Endpoint.
12:07:45.760 [cb-io-1-3] DEBUG c.c.client.core.service.Service - [pt-host][ViewService]: Connected Service.
12:07:45.760 [cb-io-1-2] DEBUG c.c.c.c.e.AbstractGenericHandler - [pt-host/10.1.21.38:8091][ConfigEndpoint]: Channel Active.
12:07:45.761 [cb-io-1-3] DEBUG c.c.c.c.e.AbstractGenericHandler - [pt-host/10.1.21.38:8092][ViewEndpoint]: Channel Active.
12:07:45.761 [cb-io-1-4] DEBUG c.c.client.core.endpoint.Endpoint - [pt-host/10.1.21.38:8093][QueryEndpoint]: Connected Endpoint.
12:07:45.761 [cb-io-1-4] DEBUG c.c.client.core.service.Service - [pt-host][QueryService]: Connected Service.
12:07:45.761 [cb-io-1-4] DEBUG com.couchbase.client.core.node.Node - Connected (DEGRADED) to Node pt-host/10.1.21.38
12:07:45.761 [cb-io-1-4] DEBUG c.c.c.c.e.AbstractGenericHandler - [pt-host/10.1.21.38:8093][QueryEndpoint]: Channel Active.
2014-11-27 12:07:45.852 INFO net.thumbtack.test.client.CouchbaseClient: Querying: select * from default order by submittedOn limit 1
java.lang.RuntimeException: java.util.concurrent.TimeoutException
at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:482)
at rx.observables.BlockingObservable.single(BlockingObservable.java:349)
at com.couchbase.client.java.CouchbaseBucket.query(CouchbaseBucket.java:612)
at com.couchbase.client.java.CouchbaseBucket.query(CouchbaseBucket.java:574)
at net.thumbtack.test.client.CouchbaseClient.searchN1QL(CouchbaseClient.java:132)
at net.thumbtack.test.client.JsonQueryClientThread$5.run(JsonQueryClientThread.java:118)
at net.thumbtack.test.client.JsonQueryClientThread.run(JsonQueryClientThread.java:165)
Caused by: java.util.concurrent.TimeoutException
at rx.internal.operators.OperatorTimeoutBase$TimeoutSubscriber.onTimeout(OperatorTimeoutBase.java:169)
at rx.internal.operators.OperatorTimeout$1$1.call(OperatorTimeout.java:42)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:45)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
2014-11-27 12:09:00.858 INFO com.couchbase.client.CouchbaseConnection: Shut down Couchbase client

And this at ./cbq-engine -couchbase http://pt-host:8091 process in linux
fatal error: runtime: out of memory

goroutine 704 [running]:
[fp=0x7f7576a76a30] runtime.throw(0xc2a117)
/usr/local/go/src/pkg/runtime/panic.c:473 +0x67


#2

Same problem as my previous response. Because LIMIT is not applied early enough in DP3, you need a WHERE clause if the data source exceeds memory. This will be fixed in DP4.