You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// We've given up waiting on the future, but it's still running. Cancel to make sure that the request timeout logic
451
-
// (readTimeout) will not kick in, because that would release the connection. This will work since connectTimeout is
452
-
// generally lower than readTimeout (and if not, we'll get an ExecutionException and defunct below).
453
-
future.cancel(true);
454
-
logger.warn(String.format("Timeout while setting keyspace on connection to %s. This should not happen but is not critical (it will retried)", address));
455
-
// Rethrow so that the caller will not try to use the connection, but do not defunct as we don't want to mark down
456
-
thrownewConnectionException(address, "Timeout while setting keyspace on connection");
457
446
} catch (BusyConnectionExceptione) {
458
-
logger.warn(String.format("Tried to set the keyspace on busy connection to %s. This should not happen but is not critical (it will retried)", address));
447
+
logger.warn("Tried to set the keyspace on busy connection to {}. "
448
+
+ "This should not happen but is not critical (it will be retried)", address);
459
449
thrownewConnectionException(address, "Tried to set the keyspace on busy connection");
460
450
} catch (ExecutionExceptione) {
461
-
throwdefunct(newConnectionException(address, "Error while setting keyspace", e.getCause()));
451
+
Throwablecause = e.getCause();
452
+
if (causeinstanceofOperationTimedOutException) {
453
+
// The timeout logic released the connection, but that's wrong since we did not borrow it in the first place.
454
+
// JAVA-901 will fix this, in the meantime make sure the inFlight count is not off by one.
455
+
inFlight.incrementAndGet();
456
+
457
+
// Rethrow so that the caller doesn't try to use the connection, but do not defunct as we don't want to mark down
458
+
logger.warn("Timeout while setting keyspace on connection to {}. "
459
+
+ "This should not happen but is not critical (it will be retried)", address);
460
+
thrownewConnectionException(address, "Timeout while setting keyspace on connection");
461
+
} else {
462
+
throwdefunct(newConnectionException(address, "Error while setting keyspace", cause));
thrownewDriverInternalError(String.format("No responses after %d milliseconds while setting current keyspace. This should not happen, unless you have setup a very low connection timeout.", timeout));
0 commit comments