From 5233ab9831003a376fed42f85b5cc8bbbfbe8352 Mon Sep 17 00:00:00 2001 From: David Roberts Date: Mon, 20 Feb 2017 10:56:20 +0000 Subject: [PATCH] Don't try to get the native code version in the transport client (elastic/x-pack-elasticsearch#600) The native controller process won't be running Original commit: elastic/x-pack-elasticsearch@d848e86cd554d58ead59a5d87ec951d300aec42c --- .../xpack/ml/MachineLearningFeatureSet.java | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearningFeatureSet.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearningFeatureSet.java index 11df1d24f0c..4711dd6ed33 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearningFeatureSet.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearningFeatureSet.java @@ -33,16 +33,19 @@ public class MachineLearningFeatureSet implements XPackFeatureSet { this.enabled = XPackSettings.MACHINE_LEARNING_ENABLED.get(settings); this.licenseState = licenseState; Map nativeCodeInfo = NativeController.UNKNOWN_NATIVE_CODE_INFO; - try { - NativeController nativeController = NativeControllerHolder.getNativeController(settings); - if (nativeController != null) { - nativeCodeInfo = nativeController.getNativeCodeInfo(); - } - } catch (IOException | TimeoutException e) { - Loggers.getLogger(MachineLearningFeatureSet.class).error("Cannot get native code info for Machine Learning", e); - if (enabled) { - throw new ElasticsearchException("Cannot communicate with Machine Learning native code " - + "- please check that you are running on a supported platform"); + // Don't try to get the native code version in the transport client - the controller process won't be running + if (XPackPlugin.transportClientMode(settings) == false) { + try { + NativeController nativeController = NativeControllerHolder.getNativeController(settings); + if (nativeController != null) { + nativeCodeInfo = nativeController.getNativeCodeInfo(); + } + } catch (IOException | TimeoutException e) { + Loggers.getLogger(MachineLearningFeatureSet.class).error("Cannot get native code info for Machine Learning", e); + if (enabled) { + throw new ElasticsearchException("Cannot communicate with Machine Learning native code " + + "- please check that you are running on a supported platform"); + } } } this.nativeCodeInfo = nativeCodeInfo;