Skip to content

Commit dd470e9

Browse files
authored
[ML] Improve message when native controller cannot connect (elastic#43565)
The error message if the native controller failed to run (for example due to running Elasticsearch on an unsupported platform) was not easy to understand. This change removes pointless detail from the message and adds some hints about likely causes. Fixes elastic#42341
1 parent 9fcf03a commit dd470e9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,14 @@ public Collection<Object> createComponents(Client client, ClusterService cluster
481481
normalizerProcessFactory = new NativeNormalizerProcessFactory(environment, nativeController);
482482
analyticsProcessFactory = new NativeAnalyticsProcessFactory(environment, nativeController);
483483
} catch (IOException e) {
484-
// This also should not happen in production, as the MachineLearningInfoTransportAction should have
485-
// hit the same error first and brought down the node with a friendlier error message
486-
throw new ElasticsearchException("Failed to create native process factories for Machine Learning", e);
484+
// The low level cause of failure from the named pipe helper's perspective is almost never the real root cause, so
485+
// only log this at the lowest level of detail. It's almost always "file not found" on a named pipe we expect to be
486+
// able to connect to, but the thing we really need to know is what stopped the native process creating the named pipe.
487+
logger.trace("Failed to connect to ML native controller", e);
488+
throw new ElasticsearchException("Failure running machine learning native code. This could be due to running "
489+
+ "on an unsupported OS or distribution, missing OS libraries, or a problem with the temp directory. To "
490+
+ "bypass this problem by running Elasticsearch without machine learning functionality set ["
491+
+ XPackSettings.MACHINE_LEARNING_ENABLED.getKey() + ": false].");
487492
}
488493
} else {
489494
autodetectProcessFactory = (job, autodetectParams, executorService, onProcessCrash) ->

0 commit comments

Comments
 (0)