diff --git a/core/src/main/java/org/elasticsearch/env/NodeEnvironment.java b/core/src/main/java/org/elasticsearch/env/NodeEnvironment.java index 80c427c9cdc..5eecafa252f 100644 --- a/core/src/main/java/org/elasticsearch/env/NodeEnvironment.java +++ b/core/src/main/java/org/elasticsearch/env/NodeEnvironment.java @@ -47,6 +47,7 @@ import org.elasticsearch.index.store.FsDirectoryService; import org.elasticsearch.monitor.fs.FsInfo; import org.elasticsearch.monitor.fs.FsProbe; import org.elasticsearch.monitor.jvm.JvmInfo; +import org.elasticsearch.monitor.process.ProcessProbe; import java.io.Closeable; import java.io.IOException; @@ -221,6 +222,7 @@ public class NodeEnvironment extends AbstractComponent implements Closeable { maybeLogPathDetails(); maybeLogHeapDetails(); + maybeWarnFileDescriptors(); applySegmentInfosTrace(settings); } @@ -313,6 +315,20 @@ public class NodeEnvironment extends AbstractComponent implements Closeable { logger.info("heap size [{}], compressed ordinary object pointers [{}]", maxHeapSize, useCompressedOops); } + private void maybeWarnFileDescriptors() { + long maxFileDescriptorCount = ProcessProbe.getInstance().getMaxFileDescriptorCount(); + if (maxFileDescriptorCount == -1) { + return; + } + int fileDescriptorCountThreshold = (1 << 16); + if (maxFileDescriptorCount < fileDescriptorCountThreshold) { + logger.warn( + "max file descriptors [{}] for elasticsearch process likely too low, consider increasing to at least [{}]", + maxFileDescriptorCount, + fileDescriptorCountThreshold); + } + } + @SuppressForbidden(reason = "System.out.*") static void applySegmentInfosTrace(Settings settings) { if (ENABLE_LUCENE_SEGMENT_INFOS_TRACE_SETTING.get(settings)) {