com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /138.120.140.92 (com.datastax.driver.core.TransportException: [/138.120.140.92] Cannot connect), /138.120.140.96 (com.datastax.driver.core.TransportException: [/138.120.140.96] Cannot connect), /138.120.140.99 (com.datastax.driver.core.TransportException: [/138.120.140.99] Cannot connect))

DataStax JIRA | Andre Campeau | 3 years ago
  1. 0

    Started our server which attempts to periodically connect to a cluster which is built like this: cluster = Cluster.builder().withRetryPolicy(lRetryPolicy).withSocketOptions(new SocketOptions().setReadTimeoutMillis(360000).setConnectTimeoutMillis(20000)).withLoadBalancingPolicy(new RoundRobinPolicy()).addContactPoints(dbIpAddress.split(",")).build(); when all Cassandra nodes in the cluster are down. Just under 5 minutes later I started all the Cassandra nodes. Here is the first NoHostAvailableException: <2014.05.26 13:46:37 688 -0400><E><acampeau-desktop><RIWorker [2]><server.cassandra.session.CassandraSessionManager.allocateSession> EXCEPTION logged in com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /138.120.140.92 (com.datastax.driver.core.TransportException: [/138.120.140.92] Cannot connect), /138.120.140.96 (com.datastax.driver.core.TransportException: [/138.120.140.96] Cannot connect), /138.120.140.99 (com.datastax.driver.core.TransportException: [/138.120.140.99] Cannot connect)) at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:195) at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:78) at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:977) at com.datastax.driver.core.Cluster$Manager.newSession(Cluster.java:1014) at com.datastax.driver.core.Cluster$Manager.access$200(Cluster.java:889) at com.datastax.driver.core.Cluster.connect(Cluster.java:170) at com.datastax.driver.core.Cluster.connect(Cluster.java:189) at ... Less then 200ms later and subsequently for hours later, I kept seeing the following: [java.util.concurrent.RejectedExecutionException]: Task com.google.common.util.concurrent.ListenableFutureTask@4a7c295a rejected from java.util.concurrent.ThreadPoolExecutor@527feed0[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2048) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372) at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132) at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:58) at com.datastax.driver.core.SessionManager.addOrRenewPool(SessionManager.java:236) at com.datastax.driver.core.SessionManager.<init>(SessionManager.java:57) at com.datastax.driver.core.Cluster$Manager.newSession(Cluster.java:1016) at com.datastax.driver.core.Cluster$Manager.access$200(Cluster.java:889) at com.datastax.driver.core.Cluster.connect(Cluster.java:170) at com.datastax.driver.core.Cluster.connect(Cluster.java:189) at ... In the debugger I see the cluster.manager.executor as Terminated. Next server restart with Cassandra cluster nodes all down produced the same result.

    DataStax JIRA | 3 years ago | Andre Campeau
    com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /138.120.140.92 (com.datastax.driver.core.TransportException: [/138.120.140.92] Cannot connect), /138.120.140.96 (com.datastax.driver.core.TransportException: [/138.120.140.96] Cannot connect), /138.120.140.99 (com.datastax.driver.core.TransportException: [/138.120.140.99] Cannot connect))
  2. 0

    Started our server which attempts to periodically connect to a cluster which is built like this: cluster = Cluster.builder().withRetryPolicy(lRetryPolicy).withSocketOptions(new SocketOptions().setReadTimeoutMillis(360000).setConnectTimeoutMillis(20000)).withLoadBalancingPolicy(new RoundRobinPolicy()).addContactPoints(dbIpAddress.split(",")).build(); when all Cassandra nodes in the cluster are down. Just under 5 minutes later I started all the Cassandra nodes. Here is the first NoHostAvailableException: <2014.05.26 13:46:37 688 -0400><E><acampeau-desktop><RIWorker [2]><server.cassandra.session.CassandraSessionManager.allocateSession> EXCEPTION logged in com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /138.120.140.92 (com.datastax.driver.core.TransportException: [/138.120.140.92] Cannot connect), /138.120.140.96 (com.datastax.driver.core.TransportException: [/138.120.140.96] Cannot connect), /138.120.140.99 (com.datastax.driver.core.TransportException: [/138.120.140.99] Cannot connect)) at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:195) at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:78) at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:977) at com.datastax.driver.core.Cluster$Manager.newSession(Cluster.java:1014) at com.datastax.driver.core.Cluster$Manager.access$200(Cluster.java:889) at com.datastax.driver.core.Cluster.connect(Cluster.java:170) at com.datastax.driver.core.Cluster.connect(Cluster.java:189) at ... Less then 200ms later and subsequently for hours later, I kept seeing the following: [java.util.concurrent.RejectedExecutionException]: Task com.google.common.util.concurrent.ListenableFutureTask@4a7c295a rejected from java.util.concurrent.ThreadPoolExecutor@527feed0[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2048) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372) at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132) at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:58) at com.datastax.driver.core.SessionManager.addOrRenewPool(SessionManager.java:236) at com.datastax.driver.core.SessionManager.<init>(SessionManager.java:57) at com.datastax.driver.core.Cluster$Manager.newSession(Cluster.java:1016) at com.datastax.driver.core.Cluster$Manager.access$200(Cluster.java:889) at com.datastax.driver.core.Cluster.connect(Cluster.java:170) at com.datastax.driver.core.Cluster.connect(Cluster.java:189) at ... In the debugger I see the cluster.manager.executor as Terminated. Next server restart with Cassandra cluster nodes all down produced the same result.

    DataStax JIRA | 3 years ago | Andre Campeau
    com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /138.120.140.92 (com.datastax.driver.core.TransportException: [/138.120.140.92] Cannot connect), /138.120.140.96 (com.datastax.driver.core.TransportException: [/138.120.140.96] Cannot connect), /138.120.140.99 (com.datastax.driver.core.TransportException: [/138.120.140.99] Cannot connect))
  3. 0

    Does not work with Cassandra 3.0

    GitHub | 11 months ago | gw0
    com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /1.2.3.4:9042 (com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table schema_keyspaces))
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [Kundera-datastax] NoHostAvailableException

    GitHub | 2 years ago | ansarrafique
    com.impetus.kundera.KunderaException: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (no host was tried)
  6. 0

    Intermittent Cassandra connection failures

    GitHub | 2 years ago | mkaberman
    com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9142 (com.datastax.driver.core.TransportException: [/127.0.0.1:9142] Cannot connect))

  1. kid 2 times, last 2 weeks ago
24 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. com.datastax.driver.core.exceptions.NoHostAvailableException

    All host(s) tried for query failed (tried: /138.120.140.92 (com.datastax.driver.core.TransportException: [/138.120.140.92] Cannot connect), /138.120.140.96 (com.datastax.driver.core.TransportException: [/138.120.140.96] Cannot connect), /138.120.140.99 (com.datastax.driver.core.TransportException: [/138.120.140.99] Cannot connect))

    at com.datastax.driver.core.ControlConnection.reconnectInternal()
  2. DataStax Java Driver for Apache Cassandra - Core
    Cluster.connect
    1. com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:195)
    2. com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:78)
    3. com.datastax.driver.core.Cluster$Manager.init(Cluster.java:977)
    4. com.datastax.driver.core.Cluster$Manager.newSession(Cluster.java:1014)
    5. com.datastax.driver.core.Cluster$Manager.access$200(Cluster.java:889)
    6. com.datastax.driver.core.Cluster.connect(Cluster.java:170)
    7. com.datastax.driver.core.Cluster.connect(Cluster.java:189)
    7 frames