Connect to leader candidate does not support reconnection attempts
dpasek-senacor opened this issue · 0 comments
dpasek-senacor commented
Situation
- Client is connected to a leader node.
- In the event store cluster a master releection is performed
- Client performs operation against node, now being a follower
- Operations fails with a NotLeaderException containing the proposed leader candidate.
- Client performs a reconnect against this leader candidate but connecton attempt fails.
Expected behavior
- The client retries to connect to the leader candidate using cluster member discovery
Observed behavior
- The client instance is shutdown and is no longer usable.
Issue is located in the following code of the GrpcClient.discover() method:
if (candidate.isPresent()) {
shutdownPreviousChannelIfExists();
this.endpoint = candidate.get();
this.channel = createChannel(this.endpoint);
try {
if (loadServerFeatures()) {
this.currentChannelId = UUID.randomUUID();
return true;
}
} catch (Exception e) {
logger.error("A fatal exception happened when fetching server supported features", e);
}
return false;
}The return false (causing the shutdown of the client) is triggered after an unexpected exception or if the server features could not be loaded. It would be better to just remove the return false which than will fallback into the standard discovery/node selection process applying reconnect attempts.