com.datastax.driver.core.exceptions.NoHostAvailableException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Possible network corruption issue
    via GitHub by jprellberg
    ,
  • GitHub comment 832#156657004
    via GitHub by drax68
    ,
  • NoHostAvailableException
    via by Unknown author,
  • NoHostAvailableException
    via by Unknown author,
  • GitHub comment 225#198262957
    via GitHub by styjdt
    ,
  • When passing ReadOnly buffer (ByteBuffer.wrap(arr).asReadOnlyBuffer()) to Blob type field, the driver seems to fail to construct message with following found in log : {code} com.datastax.driver.core.exceptions.TransportException: [/127.0.0.1] Error writing at com.datastax.driver.core.Connection$10.operationComplete(Connection.java:564) ~[cassandra-driver-core-3.0.1.jar:na] at com.datastax.driver.core.Connection$10.operationComplete(Connection.java:548) ~[cassandra-driver-core-3.0.1.jar:na] at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:680) ~[netty-common-4.0.33.Final.jar:4.0.33.Final] at io.netty.util.concurrent.DefaultPromise.notifyLateListener(DefaultPromise.java:621) ~[netty-common-4.0.33.Final.jar:4.0.33.Final] at io.netty.util.concurrent.DefaultPromise.addListener(DefaultPromise.java:138) ~[netty-common-4.0.33.Final.jar:4.0.33.Final] at io.netty.channel.DefaultChannelPromise.addListener(DefaultChannelPromise.java:93) ~[netty-transport-4.0.33.Final.jar:4.0.33.Final] at io.netty.channel.DefaultChannelPromise.addListener(DefaultChannelPromise.java:28) ~[netty-transport-4.0.33.Final.jar:4.0.33.Final] at com.datastax.driver.core.Connection$Flusher.run(Connection.java:878) ~[cassandra-driver-core-3.0.1.jar:na] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358) ~[netty-common-4.0.33.Final.jar:4.0.33.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) ~[netty-transport-4.0.33.Final.jar:4.0.33.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) ~[netty-common-4.0.33.Final.jar:4.0.33.Final] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40] Caused by: io.netty.handler.codec.EncoderException: java.nio.ReadOnlyBufferException at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107) ~[netty-codec-4.0.33.Final.jar:4.0.33.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:643) ~[netty-transport-4.0.33.Final.jar:4.0.33.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:700) ~[netty-transport-4.0.33.Final.jar:4.0.33.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:636) ~[netty-transport-4.0.33.Final.jar:4.0.33.Final] at io.netty.handler.timeout.IdleStateHandler.write(IdleStateHandler.java:284) ~[netty-handler-4.0.33.Final.jar:4.0.33.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:643) ~[netty-transport-4.0.33.Final.jar:4.0.33.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:700) ~[netty-transport-4.0.33.Final.jar:4.0.33.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:636) ~[netty-transport-4.0.33.Final.jar:4.0.33.Final] at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:622) ~[netty-transport-4.0.33.Final.jar:4.0.33.Final] at io.netty.channel.DefaultChannelPipeline.write(DefaultChannelPipeline.java:939) ~[netty-transport-4.0.33.Final.jar:4.0.33.Final] at io.netty.channel.AbstractChannel.write(AbstractChannel.java:234) ~[netty-transport-4.0.33.Final.jar:4.0.33.Final] ... 5 common frames omitted Caused by: java.nio.ReadOnlyBufferException: null at java.nio.ByteBuffer.array(ByteBuffer.java:996) ~[na:1.8.0_40] at io.netty.buffer.UnsafeByteBufUtil.setBytes(UnsafeByteBufUtil.java:368) ~[netty-buffer-4.0.33.Final.jar:4.0.33.Final] at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:205) ~[netty-buffer-4.0.33.Final.jar:4.0.33.Final] at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:877) ~[netty-buffer-4.0.33.Final.jar:4.0.33.Final] at com.datastax.driver.core.CBUtil.writeValue(CBUtil.java:319) ~[cassandra-driver-core-3.0.1.jar:na] at com.datastax.driver.core.CBUtil.writeValueList(CBUtil.java:344) ~[cassandra-driver-core-3.0.1.jar:na] at com.datastax.driver.core.Requests$QueryProtocolOptions.encode(Requests.java:319) ~[cassandra-driver-core-3.0.1.jar:na] at com.datastax.driver.core.Requests$Execute$1.encode(Requests.java:169) ~[cassandra-driver-core-3.0.1.jar:na] at com.datastax.driver.core.Requests$Execute$1.encode(Requests.java:165) ~[cassandra-driver-core-3.0.1.jar:na] at com.datastax.driver.core.Message$ProtocolEncoder.encode(Message.java:319) ~[cassandra-driver-core-3.0.1.jar:na] at com.datastax.driver.core.Message$ProtocolEncoder.encode(Message.java:280) ~[cassandra-driver-core-3.0.1.jar:na] at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ~[netty-codec-4.0.33.Final.jar:4.0.33.Final] ... 15 common frames omitted {code} That in fact causes following exception to be propagated {code} All host(s) tried for query failed (tried: /127.0.0.1:12000 (com.datastax.driver.core.exceptions.TransportException: [/127.0.0.1] Error writing)) com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:12000 (com.datastax.driver.core.exceptions.TransportException: [/127.0.0.1] Error writing)) at com.datastax.driver.core.RequestHandler.reportNoMoreHosts(RequestHandler.java:211) at com.datastax.driver.core.RequestHandler.access$1000(RequestHandler.java:43) at com.datastax.driver.core.RequestHandler$SpeculativeExecution.sendRequest(RequestHandler.java:277) at com.datastax.driver.core.RequestHandler$SpeculativeExecution$1.run(RequestHandler.java:400) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) {code} making the connection with server defunct. Expected behaviour. 1) If the buffer must not be read-only, then this shall be asserted immediatelly when the row of blob field is constructed 2) Only that particular request shall fail, reporting the exception back, connection shall be availble for further request 3) Even when connection will fail for this reason, driver shall be able to allocate new connection w/o dormant time pretending that server have failed.
    via by Pavel Chlupacek,
  • Considering the following scenario: 1. from a CQL query containing a column A that exists in C* prepare a statement and cache it 2. run the prepared statement, it succeeds 3. remove the column A from C* 4. run the prepared statement, it fails with the following stack trace {code} com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /192.168.3.11:9042 (com.datastax.driver.core.exceptions.DriverException: Error preparing query, got ERROR INVALID: Undefined name edge_id in where clause ('edge_id = ?'))) com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /192.168.3.11:9042 (com.datastax.driver.core.exceptions.DriverException: Error preparing query, got ERROR INVALID: Undefined name edge_id in where clause ('edge_id = ?'))) at com.datastax.driver.core.RequestHandler.reportNoMoreHosts(RequestHandler.java:218) [cassandra-driver-core-3.0.0.jar:na] at com.datastax.driver.core.RequestHandler.access$1000(RequestHandler.java:43) [cassandra-driver-core-3.0.0.jar:na] at com.datastax.driver.core.RequestHandler$SpeculativeExecution.sendRequest(RequestHandler.java:284) [cassandra-driver-core-3.0.0.jar:na] at com.datastax.driver.core.RequestHandler$SpeculativeExecution$1.run(RequestHandler.java:406) [cassandra-driver-core-3.0.0.jar:na] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_72] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_72] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_72] {code} Being it a problem of query preparation in C* an InvalidQueryException should be expected instead.
    via by Massimiliano Tomassi,
  • Here is 3.0 driver based code: {code} Cluster cluster = Cluster.builder().addContactPoint("127.0.0.1").build(); Session session = cluster.connect(); PreparedStatement ps = session.prepare("select * from system.local"); ResultSet rs = session.execute(ps.bind()); {code} This worked fine against cassandra 2.0. We do have some cassandra 1.2 clusters. There it fails with {code} com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.exceptions.ServerError: An unexpected error occurred server side on /127.0.0.1:9042: java.lang.IndexOutOfBoundsException: Not enough readable bytes - Need 4, maximum is 0)) at com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:84) at com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:37) at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37) at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:245) at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:63) at mme.cassandraclient.tests.CassandraClusterTests.createCluster(CassandraClusterTests.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) Caused by: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.exceptions.ServerError: An unexpected error occurred server side on /127.0.0.1:9042: java.lang.IndexOutOfBoundsException: Not enough readable bytes - Need 4, maximum is 0)) at com.datastax.driver.core.RequestHandler.reportNoMoreHosts(RequestHandler.java:217) at com.datastax.driver.core.RequestHandler.access$1000(RequestHandler.java:43) at com.datastax.driver.core.RequestHandler$SpeculativeExecution.sendRequest(RequestHandler.java:284) at com.datastax.driver.core.RequestHandler$SpeculativeExecution$1.run(RequestHandler.java:406) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) {code} Here is the error on cassandra: {code} java.lang.IndexOutOfBoundsException: Not enough readable bytes - Need 4, maximum is 0 at org.jboss.netty.buffer.AbstractChannelBuffer.checkReadableBytes(AbstractChannelBuffer.java:661) at org.jboss.netty.buffer.AbstractChannelBuffer.readInt(AbstractChannelBuffer.java:273) at org.apache.cassandra.transport.CBUtil.readValue(CBUtil.java:248) at org.apache.cassandra.transport.messages.ExecuteMessage$1.decode(ExecuteMessage.java:49) at org.apache.cassandra.transport.messages.ExecuteMessage$1.decode(ExecuteMessage.java:41) at org.apache.cassandra.transport.Message$ProtocolDecoder.decode(Message.java:210) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:66) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:68) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462) at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443) at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:109) at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:90) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) {code} Looking through cassandra code, server gets the count of bound variables as 10 for some reasons and tries to read them and obviously fails. Adding .withProtocolVersion(ProtocolVersion.V1) did not make any difference.
    via by Vishy Kasar,
    • com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: localhost/127.0.0.1:9042 (com.datastax.driver.core.exceptions.ServerError: An unexpected error occurred server side on localhost/127.0.0.1:9042: java.lang.IndexOutOfBoundsException: index: 4096, length: 1664221440 (expected: range(0, 45014)))) at com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:84) at com.datastax.driver.core.exceptions.NoHostAvailableException.copy(NoHostAvailableException.java:37) at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37) at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:245) at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:64) at dbp.BatchTest4.main(BatchTest4.java:32) Caused by: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: localhost/127.0.0.1:9042 (com.datastax.driver.core.exceptions.ServerError: An unexpected error occurred server side on localhost/127.0.0.1:9042: java.lang.IndexOutOfBoundsException: index: 4096, length: 1664221440 (expected: range(0, 45014)))) at com.datastax.driver.core.RequestHandler.reportNoMoreHosts(RequestHandler.java:207) at com.datastax.driver.core.RequestHandler.access$1000(RequestHandler.java:43) at com.datastax.driver.core.RequestHandler$SpeculativeExecution.sendRequest(RequestHandler.java:273) at com.datastax.driver.core.RequestHandler$SpeculativeExecution$1.run(RequestHandler.java:396) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    1 more bugmates