Skip to content

PoolTimeoutException when connecting to Cassandra via Astyanax #86

akolyadenko opened this Issue Jul 22, 2012 · 8 comments

9 participants


I am trying to connect to local cassandra using astyanax, but constantly getting PoolTimeoutException. I am able to connect to cassandra using cli or hector client. Any idea what am I doing wrong?


My code:

val context = new AstyanaxContext.Builder()
new AstyanaxConfigurationImpl()
new ConnectionPoolConfigurationImpl("ConnPool")
.withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
return context.getEntity()

Exception in thread "main" java.lang.RuntimeException: PoolTimeoutException: [host=, latency=10004(10004), attempts=1] Timed out waiting for connection
at scala.collection.JavaConversions$JIteratorWrapper.hasNext(JavaConversions.scala:574)
at scala.collection.Iterator$class.foreach(Iterator.scala:772)
at scala.collection.JavaConversions$JIteratorWrapper.foreach(JavaConversions.scala:573)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:73)
at scala.collection.JavaConversions$JIterableWrapper.foreach(JavaConversions.scala:587)
at at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:60)
at scala.App$$anonfun$main$1.apply(App.scala:60)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:76)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:30)
at scala.App$class.main(App.scala:60)
at Caused by: PoolTimeoutException: [host=, latency=10004(10004), attempts=1] Timed out waiting for connection


I coppied in your code and it looks fine w/ the addition of a ; before the context.start
Try changing your monitor to
.withConnectionPoolMonitor(new Slf4jConnectionPoolMonitorImpl())
and you should get a logged reason on why it isn't connecting correctly.

Or try debugging thru to see some of the inner workings.



had the same problem when I tried Astyanax first time today with latest version (1.0.6) found in Maven-Central.
Switching to the Slf4jConnectionPoolMonitorImpl does not gave me more hints to the problem.

After looking to some Unit-Tests of Astyanax to make sure I'm not totally stupid and doing the right thing, I just switched back to version 1.0.0. And you may don't believe it my code was working. Yeah.

I go version by version to see when it breaks again. At 1.0.4 it stops working.

Result: 1.0.0, 1.0.1, 1.0.2, 1.0.3 all working. 1.0.4., 1.0.5, 1.0.6 NOT WORKING.


bellombp:cassandra-session-manager-astyanax jbellmann$ java -version
java version "1.7.0_06"
Java(TM) SE Runtime Environment (build 1.7.0_06-b24)
Java HotSpot(TM) 64-Bit Server VM (build 23.2-b09, mixed mode)

maven-compiler-plugin was set to 1.6 for 'source' and 'target'

You can have a look at the sources here


iqdk commented Aug 31, 2012


I was getting the same error... Debugging into the Astyanax code shows this error:

java.lang.IncompatibleClassChangeError: class org.apache.cassandra.thrift.Cassandra$Client has interface org.apache.thrift.TServiceClient as super class

Just curious, what version of Cassandra did you use?
We just tried 1.1.2 (released about a month ago).




I use the cassandra-maven-plugin in version 1.0.0-1 which uses cassandra 1.0 I think. I tried to update to a newer version but I had trouble with some 'snappy-stuff that is not in the library path' and did not found a fast solution. So I run cassandra 1.0 with the above mentioned versions of astyanax.

Maybe there are some problems with the Thrift dependencies between client and cassandra.
I will investigate some time next week to find out more hopefully.

Hope that answers your question.


ivanvel commented Nov 1, 2012

Hi guys, just a guess, is your cassandra configured properly so it allows diffferent IPs (default one is
Check rpc_address property in cassandra.yaml as only those specified there can be used by clients whether it's astyanax, cqlsh or cli.

@elandau elandau closed this Nov 15, 2012
raresp commented Dec 14, 2012

I am having the same problem.
Astyanax times out while the cli and cqlsh work just fine.

Caused by: org.apache.thrift.transport.TTransportException: Read timed out
at org.apache.thrift.transport.TTransport.readAll(
at org.apache.thrift.transport.TFramedTransport.readFrame(
at org.apache.thrift.transport.TTransport.readAll(
at org.apache.thrift.protocol.TBinaryProtocol.readAll(
at org.apache.thrift.protocol.TBinaryProtocol.readI32(
at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(
at org.apache.thrift.TServiceClient.receiveBase(
at org.apache.cassandra.thrift.Cassandra$Client.recv_get_indexed_slices(
at org.apache.cassandra.thrift.Cassandra$Client.get_indexed_slices(

Why was this issue closed?


there are two scenario here:
1. Your Cassandra listens on IP / Port numbers which are completely different from your test code client; in this case you will constantly get PoolTimeoutException

  1. Read timed out
  2. try to increase it, .setSocketTimeout(30000), your queries could be slow:

    new ConnectionPoolConfigurationImpl(TEST_CLUSTER_NAME

diguage commented Jan 4, 2015

I had the same error.Now, it is OK.

The main problem is that the configuration is wrong.

My configuration is as following:

My visual machine ip is cassandra was installed into the machine.So, I configurate thar


That is OK。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.