From b080237837221f7c7a53004c32d07b59501b3e4e Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 28 Jan 2020 18:44:06 -0500 Subject: [PATCH] Ignore virtual ethernet devices that disappear (#51581) When checking if a device is up, today we can run into virtual ethernet devices that disappear while we are in the middle of checking. This leads to "no such device". This commit addresses such devices by treating them as not being up, if they are virtual ethernet devices that disappeared while we were checking. --- .../java/org/elasticsearch/common/network/NetworkUtils.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/main/java/org/elasticsearch/common/network/NetworkUtils.java b/server/src/main/java/org/elasticsearch/common/network/NetworkUtils.java index 6a49f0d7658..c3e82094634 100644 --- a/server/src/main/java/org/elasticsearch/common/network/NetworkUtils.java +++ b/server/src/main/java/org/elasticsearch/common/network/NetworkUtils.java @@ -172,6 +172,10 @@ public abstract class NetworkUtils { try { return intf.isUp(); } catch (final SocketException e) { + // virtual ethernet devices come and go, we will treat such a device that disappeared as not being up + if (intf.getName().startsWith("veth") && e.getMessage().equals("No such device (getFlags() failed)")) { + return false; + } throw new IOException("failed to check if interface [" + intf.getName() + "] is up", e); } }