Skip to content

Commit

Permalink
Improve handling of multicast binding exceptions
Browse files Browse the repository at this point in the history
In case the multicast binding fails (due to socket errors), abort zen
pinging code and throw a better error message
Relates #8225

(cherry picked from commit f819cff)
  • Loading branch information
costin committed Oct 28, 2014
1 parent 9e7e370 commit 7b0afaf
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -128,10 +128,11 @@ protected void doStart() throws ElasticsearchException {
new MulticastChannel.Config(port, group, bufferSize, ttl, networkService.resolvePublishHostAddress(address)),
new Receiver());
} catch (Throwable t) {
String msg = "multicast failed to start [{}], disabling. Consider using IPv4 only (by defining env. variable `ES_USE_IPV4`)";
if (logger.isDebugEnabled()) {
logger.debug("multicast failed to start [{}], disabling", t, ExceptionsHelper.detailedMessage(t));
logger.debug(msg, t, ExceptionsHelper.detailedMessage(t));
} else {
logger.info("multicast failed to start [{}], disabling", ExceptionsHelper.detailedMessage(t));
logger.info(msg, ExceptionsHelper.detailedMessage(t));
}
}
}
Expand Down Expand Up @@ -174,7 +175,7 @@ public void onPing(PingResponse[] pings) {

@Override
public void ping(final PingListener listener, final TimeValue timeout) {
if (!pingEnabled) {
if (!pingEnabled || multicastChannel == null) {
threadPool.generic().execute(new Runnable() {
@Override
public void run() {
Expand Down Expand Up @@ -496,7 +497,7 @@ private void handleExternalPingRequest(Map<String, Object> externalPingData, XCo
}

private void handleNodePingRequest(int id, DiscoveryNode requestingNodeX, ClusterName requestClusterName) {
if (!pingEnabled) {
if (!pingEnabled || multicastChannel == null) {
return;
}
final DiscoveryNodes discoveryNodes = contextProvider.nodes();
Expand Down

0 comments on commit 7b0afaf

Please sign in to comment.