Problems running Queries on N1QL dp4 and 2.1.0-dp version


#1

Hi,
I was wondering if anyone have encountered the following error while running against n1ql:
on the dp4 the repl works well the same query
my code is
Statement statement = select("*").from(“default”).where(x("_identifier").eq(x(“placement”)));
Observable query = bucket.async().query(statement);
List toReturn = new LinkedList<>();
BlockingObservable asyncQueryRowBlockingObservable = query.doOnNext(result -> {
}).flatMap(AsyncQueryResult::rows).toBlocking();
toReturn.add(asyncQueryRowBlockingObservable.first());
The exception I get:

2015-01-21 18:07:05,638][WARN ][com.couchbase.client.core.endpoint.AbstractGenericHandler] [cb-dev/172.31.29.122:8093][QueryEndpoint]: Caught unknown exception: rx.subjects.ReplaySubject.onBackpressureBuffer()Lrx/Observable;
java.lang.NoSuchMethodError: rx.subjects.ReplaySubject.onBackpressureBuffer()Lrx/Observable;
at com.couchbase.client.core.endpoint.query.QueryHandler.handleGenericQueryResponse(QueryHandler.java:288) ~[core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.core.endpoint.query.QueryHandler.decodeResponse(QueryHandler.java:187) ~[core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.core.endpoint.query.QueryHandler.decodeResponse(QueryHandler.java:62) ~[core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.core.endpoint.AbstractGenericHandler.decode(AbstractGenericHandler.java:155) ~[core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:182) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:147) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:130) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [core-io-1.1.0-dp.jar:1.1.0-dp]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_25]
[2015-01-21 18:07:05,639][WARN ][com.couchbase.client.deps.io.netty.channel.DefaultChannelPipeline] An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.NoSuchMethodError: rx.subjects.ReplaySubject.onBackpressureBuffer()Lrx/Observable;
at com.couchbase.client.core.endpoint.query.QueryHandler.handleGenericQueryResponse(QueryHandler.java:288) ~[core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.core.endpoint.query.QueryHandler.decodeResponse(QueryHandler.java:187) ~[core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.core.endpoint.query.QueryHandler.decodeResponse(QueryHandler.java:62) ~[core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.core.endpoint.AbstractGenericHandler.decode(AbstractGenericHandler.java:155) ~[core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:182) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:147) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:130) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [core-io-1.1.0-dp.jar:1.1.0-dp]
at com.couchbase.client.deps.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [core-io-1.1.0-dp.jar:1.1.0-dp]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_25]

Any ideas


#2

At first glance, it looks like a dependency problem with RxJava. Is this running in a different place than where you’d compiled it? Note this line:
java.lang.NoSuchMethodError: rx.subjects.ReplaySubject.onBackpressureBuffer()Lrx/Observable;

That would happen if the code was compiled with the proper jar on the classpath but is executing with a different jar in the classpath.


#3

Thanks so much for the quick response.

This indeed do the trick, the problem was another rxjava-core jar.
Thank you for the help.
If i may, the problems are not quit over, now i have yet another strange problem.
when I run the same code (but with the correct RX jar :smile: ) I have the following exception:
com.couchbase.client.core.CouchbaseException: java.lang.IllegalStateException: Error parsing query response (in TRANSITION) at ":
at com.couchbase.client.core.endpoint.AbstractGenericHandler.decode(AbstractGenericHandler.java:162)
at com.couchbase.client.deps.io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81)
at com.couchbase.client.deps.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89)
at com.couchbase.client.deps.io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111)
at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
at com.couchbase.client.deps.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:182)
at com.couchbase.client.deps.io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:147)
at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
at com.couchbase.client.deps.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
at com.couchbase.client.deps.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:130)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
at com.couchbase.client.deps.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
at java.lang.Thread.run(Thread.java:745)

again the query run well on the REPL but i constantly see this problem.

Thanks again for the quick response.


#4

Hi @Kobi_Harari
We found some kinds of N1QL responses that cause problems with the parser and pushed a fix on master yesterday that displayed similar symptoms. In our case it was due to a query selecting a non-existing field in JSON, which would return many empty JSON objects as results, confusing the parser.

But you may have stumbled on another one. note that activating TRACE debugging will log the chunk of response where the problem occurred

Can you share the server’s response when you run it from the REPL?


#5

I have shared the Trace log http://pastebin.com/16cKqxfC for a very simple query SELECT * FROM default limit 1
It works from REPL and doesn’t work from my java code.
The cbq works on my local computer to the Couchbase in the datacenter and the java code does not.

Thanks,
Kobi


#6

It seems you are using at least N1QL DP3 or older.
In DP4 (which is the one 2.1.0-dp java client is compatible with) the server’s response format has changed and should not be just

{
"error":
    {
        ...
    }
}

but rather something like the following

{
    ..., 
    "errors": [ //note the errorS and the array
        { ... }, //can now have multiple errors
        { ... }
    ], 
    "status": "fatal",
    ...
}

Did you get latest DP4 binaries and followed instructions here?
(DP4 build is available from here)


#7

yes, I am using DP4, actually running the same code on the couchbase/n1ql machine is working fine.
Calling the same couchbase from my computer (outside the vpc on AWS) fails.
the REPL that i have installed on my computer works well from java something is wrong i’m using the ‘com.couchbase.client:java-client:2.1.0-dp’ version from my java program.

also working on the browser and queering my remote server works well.

any more things that you think that I’m missing?


#8

@Kobi_Harari looks like you’ve been running into a bug we fixed on master already. We are planning on a dp2 next week, so you can wait for that or compile it from master if it works for you. We can give you a hand on that if you need help.


#9

Excellent news!
My software will be deployed in a month so I can definitely wait for the new dp2 version.
where will it be published? to the http://files.couchbase.com/maven2?

Thank you all for the big help!

Kobi


#10

@Kobi_Harari yes, it well be published there. Regarding your latest comment: let me point out again that developer preview software (both N1QL and 2.1-dp*) should NOT be used in production. They are developer previews for people to start toying around with new features and providing early feedback. We will not support those particular versions going forward.


#11

Thank you for the update,
I’m using n1ql from that version on none critical part of the application and I know that it is not stable yet.
Thank you for pointing out this point.

Kobi