Exceptions encountered calling getSeeds() breaks OTC thread patch by jjirsa, reviewed by jasobrown for CASSANDRA-13018
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8556a2b9 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8556a2b9 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8556a2b9 Branch: refs/heads/cassandra-3.11 Commit: 8556a2b932046ee0633b0e619d3dd04b57bb653e Parents: 70a08f1 Author: Jason Brown <jasedbr...@gmail.com> Authored: Fri Feb 17 11:03:26 2017 -0800 Committer: Jason Brown <jasedbr...@gmail.com> Committed: Fri Feb 17 13:33:18 2017 -0800 ---------------------------------------------------------------------- CHANGES.txt | 3 +++ .../cassandra/net/OutboundTcpConnection.java | 22 ++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/8556a2b9/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index d53457f..1b83501 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,6 @@ +2.2.10 + * Exceptions encountered calling getSeeds() breaks OTC thread (CASSANDRA-13018) + 2.2.9 * Coalescing strategy sleeps too much and shouldn't be enabled by default (CASSANDRA-13090) * Fix negative mean latency metric (CASSANDRA-12876) http://git-wip-us.apache.org/repos/asf/cassandra/blob/8556a2b9/src/java/org/apache/cassandra/net/OutboundTcpConnection.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/net/OutboundTcpConnection.java b/src/java/org/apache/cassandra/net/OutboundTcpConnection.java index 6ec78a4..8baac75 100644 --- a/src/java/org/apache/cassandra/net/OutboundTcpConnection.java +++ b/src/java/org/apache/cassandra/net/OutboundTcpConnection.java @@ -434,8 +434,6 @@ public class OutboundTcpConnection extends Thread // a different target version (targetVersion < MessagingService.VERSION_12) // or if the same version the handshake will finally succeed logger.trace("Target max version is {}; no version information yet, will retry", maxTargetVersion); - if (DatabaseDescriptor.getSeeds().contains(poolReference.endPoint())) - logger.warn("Seed gossip version is {}; will not connect with that version", maxTargetVersion); disconnect(); continue; } @@ -447,8 +445,24 @@ public class OutboundTcpConnection extends Thread if (targetVersion > maxTargetVersion) { logger.trace("Target max version is {}; will reconnect with that version", maxTargetVersion); - disconnect(); - return false; + try + { + if (DatabaseDescriptor.getSeeds().contains(poolReference.endPoint())) + logger.warn("Seed gossip version is {}; will not connect with that version", maxTargetVersion); + } + catch (Throwable e) + { + // If invalid yaml has been added to the config since startup, getSeeds() will throw an AssertionError + // Additionally, third party seed providers may throw exceptions if network is flakey + // Regardless of what's thrown, we must catch it, disconnect, and try again + JVMStabilityInspector.inspectThrowable(e); + logger.warn("Configuration error prevented outbound connection: {}", e.getLocalizedMessage()); + } + finally + { + disconnect(); + return false; + } } if (targetVersion < maxTargetVersion && targetVersion < MessagingService.current_version)