Clone EndpointState before sending GossipShutdown message
Patch by marcuse; reviewed by David Capwell for CASSANDRA-19115
diff --git a/CHANGES.txt b/CHANGES.txt
index 1b6eb2b..d305e2f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
5.0-beta1
+ * Clone EndpointState before sending GossipShutdown message (CASSANDRA-19115)
* SAI indexes are marked queryable during truncation (CASSANDRA-19032)
* Enable Direct-IO feature for CommitLog files using Java native API's. (CASSANDRA-18464)
* SAI fixes for composite partitions, and static and non-static rows intersections (CASSANDRA-19034)
diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java
index 731965b..b5b0cae 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -2205,7 +2205,9 @@
logger.info("Announcing shutdown");
addLocalApplicationState(ApplicationState.STATUS_WITH_PORT, StorageService.instance.valueFactory.shutdown(true));
addLocalApplicationState(ApplicationState.STATUS, StorageService.instance.valueFactory.shutdown(true));
- Message<GossipShutdown> message = Message.out(Verb.GOSSIP_SHUTDOWN, new GossipShutdown(mystate));
+ // clone endpointstate to avoid it changing between serializedSize and serialize calls
+ EndpointState clone = new EndpointState(mystate);
+ Message<GossipShutdown> message = Message.out(Verb.GOSSIP_SHUTDOWN, new GossipShutdown(clone));
for (InetAddressAndPort ep : liveEndpoints)
MessagingService.instance().send(message, ep);
Uninterruptibles.sleepUninterruptibly(SHUTDOWN_ANNOUNCE_DELAY_IN_MS.getInt(), TimeUnit.MILLISECONDS);