question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cassandra cannot connect to host in testkit

See original GitHub issue

When using an embedded Cassandra in test in lagom 1.5.0-M3, I get logged errors about failure to connect to a host. My tests still pass, but the errors look scary. 😃

Error:

[error] c.d.d.c.ControlConnection - [Control connection] Cannot connect to any host, scheduling retry in 1000 milliseconds
[error] c.d.d.c.ControlConnection - [Control connection] Cannot connect to any host, scheduling retry in 1000 milliseconds
[error] c.d.d.c.ControlConnection - [Control connection] Cannot connect to any host, scheduling retry in 2000 milliseconds
[error] c.d.d.c.ControlConnection - [Control connection] Cannot connect to any host, scheduling retry in 2000 milliseconds
[error] a.c.s.PersistentShardCoordinator - Failed to persist event type [akka.cluster.sharding.ShardCoordinator$Internal$ShardRegionRegistered] with sequence number [1] for persistenceId [/sharding/TicketEntityCoordinator].
java.util.concurrent.ExecutionException: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (no host was tried)
	at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:531)
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:492)
	at akka.persistence.cassandra.package$ListenableFutureConverter$$anon$2.$anonfun$run$2(package.scala:25)
	at scala.util.Try$.apply(Try.scala:209)
	at akka.persistence.cassandra.package$ListenableFutureConverter$$anon$2.run(package.scala:25)
	at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (no host was tried)
	at com.datastax.driver.core.RequestHandler.reportNoMoreHosts(RequestHandler.java:265)
	at com.datastax.driver.core.RequestHandler.access$1200(RequestHandler.java:62)
	at com.datastax.driver.core.RequestHandler$SpeculativeExecution.findNextHostAndQuery(RequestHandler.java:357)
	at com.datastax.driver.core.RequestHandler.startNewExecution(RequestHandler.java:138)
	at com.datastax.driver.core.RequestHandler.sendRequest(RequestHandler.java:120)
	at com.datastax.driver.core.SessionManager.execute(SessionManager.java:700)
	at com.datastax.driver.core.SessionManager.executeAsync(SessionManager.java:144)
	at akka.persistence.cassandra.session.scaladsl.CassandraSession.$anonfun$executeWrite$1(CassandraSession.scala:264)
	at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:303)
	at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:37)
[error] c.d.d.c.ControlConnection - [Control connection] Cannot connect to any host, scheduling retry in 4000 milliseconds
[error] c.d.d.c.ControlConnection - [Control connection] Cannot connect to any host, scheduling retry in 4000 milliseconds

The tests that report this are in ticket/ticket-impl/src/test/scala/com/github/erip/ticket/impl/TicketServiceSpec.scala.

Reproducer: https://github.com/erip/ticketing-service after switching plugin version from 1.4.8 to 1.5.0-M3.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:5
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
eripcommented, Apr 22, 2019

I can confirm this still happens in 1.5.0.

4reactions
Flytancommented, Apr 4, 2020

When the test was running in 1.6.1, The problem happened.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Entity testing raising exception trying to connect to Cassandra
I'm using Lagom 1.6.0-M5. I defined an Entity Spec test which uses the PersistentEntityTestDriver which allows to run the test without ...
Read more >
Cannot connect to Cassandra during tests - Google Groups
We have a situation where we are using cassandra-unit for our integration tests with spring-data-cassandra. Our integration tests work great ...
Read more >
Cassandra No host exception and Unable to connect to any ...
we have a 12 node cassandra cluster spread across 2 datacenter with 6 node in each datacenter. When trying to login to cqlsh...
Read more >
Cannot connect to DSE from Python app - Datastax Community
x server hosted DataStax Cassandra 6.8. I am able to successfully connect locally inside the Centos Shell and the nodetool status shows the ......
Read more >
cassandra.yaml file configuration
The file size limit to store hints for an unreachable host, in mebibytes. ... The partitioner can NOT be changed without reloading all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found