Could not establish DCP connection; failed in the 'select bucket' step 0x0001 (Key not found)

Hi,

We use the dcp client (version: 0.40.0, Couchbase Server version 6.6.5-10080) for data retrieval. Sometimes the initialize state step times out and following warnings are seen in the logs -

WARN  connect:279 - failure [tag(remote=xyz.com:11210)]
java.lang.RuntimeException: Could not establish DCP connection; failed in the 'select bucket' step; com.couchbase.client.dcp.buffer.DcpOps$BadResponseStatusException: 0x0001 (Key not found)
        at com.couchbase.client.dcp.transport.netty.DcpConnectHandler.channelRead0(DcpConnectHandler.java:290)
        at com.couchbase.client.dcp.transport.netty.DcpConnectHandler.channelRead0(DcpConnectHandler.java:51)
        at com.couchbase.client.dcp.deps.io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
        at com.couchbase.client.dcp.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at com.couchbase.client.dcp.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at com.couchbase.client.dcp.deps.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at com.couchbase.client.dcp.transport.netty.BucketConfigHandler.channelRead0(BucketConfigHandler.java:103)
        at com.couchbase.client.dcp.transport.netty.BucketConfigHandler.channelRead0(BucketConfigHandler.java:39)
        at com.couchbase.client.dcp.deps.io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
        at com.couchbase.client.dcp.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at com.couchbase.client.dcp.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at com.couchbase.client.dcp.deps.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at com.couchbase.client.dcp.deps.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
        at com.couchbase.client.dcp.deps.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
        at com.couchbase.client.dcp.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at com.couchbase.client.dcp.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at com.couchbase.client.dcp.deps.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at com.couchbase.client.dcp.deps.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
        at com.couchbase.client.dcp.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at com.couchbase.client.dcp.deps.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at com.couchbase.client.dcp.deps.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
        at com.couchbase.client.dcp.deps.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
        at com.couchbase.client.dcp.deps.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
        at com.couchbase.client.dcp.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
        at com.couchbase.client.dcp.deps.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
        at com.couchbase.client.dcp.deps.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
        at com.couchbase.client.dcp.deps.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
        at com.couchbase.client.dcp.deps.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at com.couchbase.client.dcp.deps.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
Caused by: com.couchbase.client.dcp.buffer.DcpOps$BadResponseStatusException: 0x0001 (Key not found)
        at com.couchbase.client.dcp.transport.netty.DcpConnectHandler.channelRead0(DcpConnectHandler.java:283)
        ... 29 more

The code looks as follows -

dcpClient.initializeState(StreamFrom.BEGINNING,
          StreamTo.NOW).block(Duration.ofSeconds(30));

Finally, state initialization fails with -

java.lang.IllegalStateException: Timeout on blocking read for 30000000000 NANOSECONDS
        at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:123)
        at reactor.core.publisher.Mono.block(Mono.java:1731)

What does this warning signify and if it could be the reason for the timeout ?

Hi @sourish .

First guess would be bad credentials, insufficient permissions, missing bucket, or something along those lines. Beyond that, I’d recommend looking for clues in the server’s memcached.log.

Thanks,
David