mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
Catch AmazonClientExceptions to prevent connection loss
If the AWS client throws an exception (e.g: because of a DNS failure) it will end up killing the rejoin thread and stop retrying which can lead to a node getting stuck unable to rejoin the cluster. Closes #30.
This commit is contained in:
parent
906326d056
commit
4da9b2cc9c
@ -19,6 +19,7 @@
|
||||
|
||||
package org.elasticsearch.discovery.ec2;
|
||||
|
||||
import com.amazonaws.AmazonClientException;
|
||||
import com.amazonaws.services.ec2.AmazonEC2;
|
||||
import com.amazonaws.services.ec2.model.*;
|
||||
import org.elasticsearch.Version;
|
||||
@ -96,7 +97,14 @@ public class AwsEc2UnicastHostsProvider extends AbstractComponent implements Uni
|
||||
public List<DiscoveryNode> buildDynamicNodes() {
|
||||
List<DiscoveryNode> discoNodes = Lists.newArrayList();
|
||||
|
||||
DescribeInstancesResult descInstances = client.describeInstances(new DescribeInstancesRequest());
|
||||
DescribeInstancesResult descInstances;
|
||||
try {
|
||||
descInstances = client.describeInstances(new DescribeInstancesRequest());
|
||||
} catch (AmazonClientException e) {
|
||||
logger.info("Exception while retrieving instance list from AWS API: {}", e.getMessage());
|
||||
logger.debug("Full exception:", e);
|
||||
return discoNodes;
|
||||
}
|
||||
|
||||
logger.trace("building dynamic unicast discovery nodes...");
|
||||
for (Reservation reservation : descInstances.getReservations()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user