Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting an CqlKeyspace while all hosts are down results to empty session (Using JavaDriver) #601

Open
alextoulps opened this issue Nov 5, 2015 · 1 comment

Comments

@alextoulps
Copy link

Hello,

More specifically in case that all hosts are unavailable in line: https://github.com/Netflix/astyanax/blob/master/astyanax-cql/src/main/java/com/netflix/astyanax/cql/CqlKeyspaceImpl.java#L404 will throw an exception that is not thrown back to the caller but just logged.

com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Cannot connect))
at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:227) ~[cassandra-driver-core-2.1.7.1.jar:?]
at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:82) ~[cassandra-driver-core-2.1.7.1.jar:?]
at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1307) ~[cassandra-driver-core-2.1.7.1.jar:?]
at com.datastax.driver.core.Cluster.init(Cluster.java:159) ~[cassandra-driver-core-2.1.7.1.jar:?]
at com.datastax.driver.core.Cluster.connect(Cluster.java:249) ~[cassandra-driver-core-2.1.7.1.jar:?]
at com.netflix.astyanax.cql.CqlKeyspaceImpl.setHosts(CqlKeyspaceImpl.java:404) [astyanax-cql-3.8.0.jar:3.8.0]

This results the caller to assume that the context is started and try to issue a cql statement resulting to a NPE that is really puzzling.

java.lang.NullPointerException: null
at com.netflix.astyanax.cql.direct.DirectCqlStatement.asPreparedStatement(DirectCqlStatement.java:80)

Moreover the ReconnectionPolicy is not applied because of this.

What are the options to solve this?

Or is there another way that that this could work?

Thank you in advance,
Alex

@alextoulps
Copy link
Author

#602 Fixed the problem for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant