Java Driver 4.15.0 incorrect connected node metric when session is closed and reinitted in same JVM

42 views
Skip to first unread message

Nitin Chhabra

unread,
Dec 13, 2023, 5:43:51 PM12/13/23
to DataStax Java Driver for Apache Cassandra User Mailing List
Requesting help for incorrect connected nodes metric when session is closed and re-initted. 

Setup
Java 8
Java Driver Version: 4.15.0
Cassandra Server: 4.X
3 nodes in Azure West

Steps to reproduce the issue
1. Init the CQLSession succesfully.
2. Observe the connected nodes metric is 3.
3. Stop the session gracefully by calling: session.closeAsync() and wait for few seconds for close.
4. Reinit the CQLSession and monitor the connected nodes metric. It goes down to 1.

On Cassandra Server side, we are able to observe connections made to all 3 nodes. Upon further debugging by putting some log statements, it appears the NodeStateManager updates its open connection count to 3, however MetaDataManager does not show all 3 nodes have active connections. The code below in MetaDatamanager gives count as 1. Please let me know if more info is needed. 

protected int connectedNodes() {
int count = 0;
for (Node node : context.getMetadataManager().getMetadata().getNodes().values()) {
node.hashCode());
if (node.getOpenConnections() > 0) {
count++;
}
}
return count;
}
Reply all
Reply to author
Forward
0 new messages