From 0c4e90c268c557630607da0d3ef7de4622c16b9f Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Wed, 16 Mar 2022 11:13:41 +0100 Subject: [PATCH] Guard `NodeTopologyView` against absent `INFO` response #2035 Lettuce now ignores when the INFO command completes exceptionally when obtaining a cluster topology and falls back to no-detail handling. --- .../io/lettuce/core/cluster/topology/NodeTopologyView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/lettuce/core/cluster/topology/NodeTopologyView.java b/src/main/java/io/lettuce/core/cluster/topology/NodeTopologyView.java index 3b46494c88..d6cca46409 100644 --- a/src/main/java/io/lettuce/core/cluster/topology/NodeTopologyView.java +++ b/src/main/java/io/lettuce/core/cluster/topology/NodeTopologyView.java @@ -64,7 +64,7 @@ private NodeTopologyView(RedisURI redisURI) { this.available = true; this.redisURI = redisURI; - Properties properties = parseInfo(info); + Properties properties = info == null ? new Properties() : parseInfo(info); this.partitions = ClusterPartitionParser.parse(clusterNodes); this.connectedClients = getClientCount(properties); this.replicationOffset = getReplicationOffset(properties); @@ -86,7 +86,7 @@ static NodeTopologyView from(RedisURI redisURI, Requests clusterNodesRequests, R TimedAsyncCommand nodes = clusterNodesRequests.getRequest(redisURI); TimedAsyncCommand info = infoRequests.getRequest(redisURI); - if (resultAvailable(nodes) && resultAvailable(info)) { + if (resultAvailable(nodes) && !nodes.isCompletedExceptionally() && resultAvailable(info)) { return new NodeTopologyView(redisURI, nodes.join(), optionallyGet(info), nodes.duration()); } return new NodeTopologyView(redisURI);