Couchbase DCP Client 0.10.0 fails with java.lang.NoSuchMethodError

dcp
java

#1

I am working on a DCP client connector with following versions.

  • DCP Client version 0.10.0
  • Java Client version 2.4.6
  • Core IO version 1.4.6
  • Rx Java version 1.2.7 (this is automatically pulled)

Whenever I run my application, I am getting following exception. I tried altering the versions of these libraries, but no luck yet. Appreciate if someone could help.

java.lang.NoSuchMethodError: com.couchbase.client.core.config.NodeInfo.hostname()Ljava/net/InetAddress;
    at com.couchbase.client.dcp.conductor.HttpStreamingConfigProvider$1.onNext(HttpStreamingConfigProvider.java:90) ~[dcp-client-0.10.0.jar:?]
    at com.couchbase.client.dcp.conductor.HttpStreamingConfigProvider$1.onNext(HttpStreamingConfigProvider.java:74) ~[dcp-client-0.10.0.jar:?]
    at rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:134) ~[rxjava-1.2.7.jar:1.2.7]
    at rx.internal.operators.NotificationLite.accept(NotificationLite.java:135) ~[rxjava-1.2.7.jar:1.2.7]
    at rx.subjects.SubjectSubscriptionManager$SubjectObserver.emitNext(SubjectSubscriptionManager.java:253) ~[rxjava-1.2.7.jar:1.2.7]
    at rx.subjects.BehaviorSubject.onNext(BehaviorSubject.java:160) ~[rxjava-1.2.7.jar:1.2.7]
    at rx.observers.SerializedObserver.onNext(SerializedObserver.java:91) ~[rxjava-1.2.7.jar:1.2.7]
    at rx.subjects.SerializedSubject.onNext(SerializedSubject.java:67) ~[rxjava-1.2.7.jar:1.2.7]
    at com.couchbase.client.dcp.transport.netty.ConfigHandler.decodeChunk(ConfigHandler.java:96) ~[dcp-client-0.10.0.jar:?]
    at com.couchbase.client.dcp.transport.netty.ConfigHandler.channelRead0(ConfigHandler.java:76) ~[dcp-client-0.10.0.jar:?]
    at com.couchbase.client.dcp.transport.netty.ConfigHandler.channelRead0(ConfigHandler.java:38) ~[dcp-client-0.10.0.jar:?]
    at com.couchbase.client.deps.io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:625) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:560) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:477) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:439) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131) ~[core-io-1.4.6.jar:?]
    at com.couchbase.client.deps.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) ~[core-io-1.4.6.jar:?]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]

Couchbase DCP Client 0.10.0 fails with java.lang.IndexOutOfBoundsException for DcpMutationMessage
#2

@niranjan.nanda the DCP client depends on a different java client version than you are using, this is why you see this exception. Can you go back to java client 2.4.4 and see if it works?


#3

@daschl I tried using java client version 2.4.4, but got following exception. The code that is causing this issue is shown below.

Problematic code:

new String(DcpMutationMessage.contentBytes(dcpEvent), CharEncoding.UTF_8)

Exception trace

2017-06-26 16:37:49.492 [Thread: nioEventLoopGroup-5-2] 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.IndexOutOfBoundsException: index: 0, length: 549 (expected: range(0, 477))
	at com.couchbase.client.deps.io.netty.buffer.AbstractByteBuf.checkIndex0(AbstractByteBuf.java:1125) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.buffer.SlicedByteBuf.getBytes(SlicedByteBuf.java:199) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.buffer.AbstractByteBuf.getBytes(AbstractByteBuf.java:440) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.dcp.message.DcpMutationMessage.contentBytes(DcpMutationMessage.java:50) ~[dcp-client-0.10.0.jar:?]
	at com.demo.dcpclient.util.function.Functions.lambda$7(Functions.java:149) ~[bin/:?]
	at com.demo.dcpclient.listener.DCPEventListenerRunnable.lambda$1(DCPEventListenerRunnable.java:185) ~[bin/:?]
	at com.couchbase.client.dcp.Client$3.onEvent(Client.java:295) ~[dcp-client-0.10.0.jar:?]
	at com.couchbase.client.dcp.transport.netty.DcpMessageHandler.channelRead(DcpMessageHandler.java:87) ~[dcp-client-0.10.0.jar:?]
	at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:280) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:396) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:248) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:625) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:560) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:477) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:439) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131) ~[core-io-1.4.4.jar:?]
	at com.couchbase.client.deps.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144) ~[core-io-1.4.4.jar:?]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]

#4

@niranjan.nanda it’s hard to tell without a code to reproduce from. @avsej any ideas based on the stack above?


#5

@avsej Please look into the trace and help me with your thoughts.

@daschl In the mean time, I am trying to do some changes to the code so that I can share here (I cannot share the existing codebase as-is, because of client confidentiality).


#6

@daschl @avsej I am trying to upload codebase that I tried to use to reproduce the error. However, this UI is not allowing me to do so saying new users are not allowed to upload files.

Is there any other way to share this codebase?


#7

@daschl @avsej, I downgraded the core-io version to 1.4.4 and the java.lang.NoSuchMethodError is gone. I am surprised why latest API was not used, but that’s up to you guys anyways.

About this java.lang.IndexOutOfBoundsException, it’s happening for every DcpMutationMessage whenever contentBytes method is invoked. Should I raise a separate ticket or you want to address it as part of this ticket?


#8

the api change on master right now and will be released soon. regarding second issue, jira ticket will be welcome.

thank you