From 83e507df236eae6b1648e7de64e50f5450d4ee1a Mon Sep 17 00:00:00 2001 From: Michael Penick Date: Fri, 27 Jan 2017 14:43:04 -0500 Subject: [PATCH] 398 - Invalid local DC can cause connect hang Fix for an issue where a session can hang during its connection process because there are no hosts available in the local DC. --- src/session.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/session.cpp b/src/session.cpp index 35fab149b..d58e95a47 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -579,6 +579,10 @@ void Session::on_control_connection_ready() { it != hosts_end; ++it) { on_add(it->second, true); } + if (pending_pool_count_ == 0) { + notify_connect_error(CASS_ERROR_LIB_NO_HOSTS_AVAILABLE, + "No hosts available for connection using the current load balancy policy"); + } if (config().core_connections_per_host() == 0) { // Special case for internal testing. Not allowed by API LOG_DEBUG("Session connected with no core IO connections");